calling COM method with Foo(..., [out] BSTR * value) from VBScript
Ist it possible开发者_开发问答 to cal a COM method with the signature
HRESULT Foo(BSTR in, [out] BSTR * out1, [out] BSTR * out2)
from VBScript?
The following:
Dim a;
Dim b;
component.Foo "something", a, b
gives an error about incompatible types.
I still could change the signature of the method.
Looks like output parameters are not supported; while ByRef
/ [in, out]
parameters are, but only on VARIANT
parameters.
From the following KB article:
INFO: Type mismatch errors when you pass parameters from an ASP component to 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 default behavior of components built with Visual Basic is to fail with a type mismatch error when trying to pass ByRef parameters to these components. OLE Automation's default type-coercion function fails when asked to convert a ByRef variant into any other ByRef type."
Also, here are other links on the topic:
In, Out, In-Out, Make up your mind Already @ MSDN blogs
VBScript “Type Mismatch” issue with “[in, out] BSTR * ” parameter SO Question
精彩评论