how to call a C++ COM function with BSTR parameter in VBScript
In my COM component written in C++, there is function: HRESULT f(BSTR id)
How to call thi开发者_如何学运维s function in VBScript?
Thanks in advance!
In order to invoke COM components from VBScript, your object must implement the IDispatch interface. Once you do this, you can do something like:
Set myObj = CreateObject("yourObject")
myObj.f "Hello, world!"
Mapping between the VARIANT argument passed in from vbscript and the BSTR argument expected by the implementation is the job of your IDispatch implementation. If you're using ATL, see this article about how to use ATL's built-in IDispatch implementation: http://flylib.com/books/en/3.90.1.47/1/
精彩评论