ActiveX 对象方法具有此签名。
long DirectIO(long Command, long* pData, BSTR* pString)
Int32 DirectIO(Int32, Int32 ByRef, System.String ByRef)
我正在尝试从 javascript 调用此方法。我尝试了多种组合,但总是收到“类型不匹配”错误。
引用链接:
calling COM method with Foo(..., [out] BSTR * value) from VBScript
VBScript "Type Mismatch" issue with "[in, out] BSTR * " parameter
https://ericlippert.com/2003/09/29/in-out-in-out-make-up-your-mind-already/
So why does VBScript produce a type mismatch error here? VBScript doesn't! The object produces the type mismatch error, which VBScript dutifully reports. The object's implementation of Invoke calls the default implementation of Invoke provided for you by the type library implementation. That thing says "I've got a reference to a variant, and that variant is a string. I need a reference to a string. That's a type mismatch."
最佳答案
鉴于我在问题中提供的所有引用资料,当前的结论是不可能直接从 Javascript 调用该函数。
但是,可能存在替代方法(COM 代理/包装器)。
关于Javascript 到 ActiveX 变量类型,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1429737/