Invoking a COM Method with Foo (..., [out] BSTR * value) from VBScript

Ist you can set a COM method with a signature

HRESULT Foo(BSTR in, [out] BSTR * out1, [out] BSTR * out2) 

from vbscript?

Following:

  Dim a; Dim b; component.Foo "something", a, b 

gives an error about incompatible types.


I can still change the method signature.

+4
source share
1 answer

It seems that the output parameters are not supported; and ByRef / [in, out] parameters are only VARIANT parameters.

In the following knowledge base article:

INFO: enter inconsistency errors when passing parameters from the ASP component to the Visual Basic component @ support.microsoft.com

"VBScript only supports VARIANT ByRef parameters. You can use VBScript to call a procedure that takes ByRef strings, but the behavior of components built using Visual Basic by default should fail with a type mismatch error when trying to pass ByRef parameters to these components. Automatic forced OLE Automation type input does not work when asked to convert a ByRef variant to any other ByRef type. "

There are also other links on this topic:

In, Out, In-Out, Make your mind Already @ MSDN Blogs
VBScript type mismatch problem with parameter "[in, out] BSTR *" SO Question

+3
source

Source: https://habr.com/ru/post/1347880/


All Articles