开发者

how to call a C++ COM function with BSTR parameter in VBScript

开发者 https://www.devze.com 2023-02-12 23:33 出处:网络
In my COM component written in C++, there is function: HRESULT f(BSTR id) How to call thi开发者_如何学运维s function 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/

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号