Volleynerd Knowledge Base

Wednesday, October 01, 2003


Script can't use [out] variable from COM object?

This is ridiculous!? I can't get a simple COM object to properly pass back an OUT BSTR parameter to a script caller (from IE).

Tried VARIANT* as the param too, but must be missing something.

This is from google groups search, but couldn't get this working either.

------
Ah, if you want VBScript, it has to be [in, out] VARIANT*. On entry
this VARIANT contains VT_BYREF | VT_VARIANT and the referenced
VARIANT contains the value (as VT_I4 for example, but it can also
be in VT_I2 or something else like VT_BSTR). You have to interpret
the value no matter its format and then store the new value in this same
embedded VARIANT. You shouldn't touch the outer VARIANT.
See VariantChangeType - use it to convert all possible formats into
VT_I4 so you don't have to deal with all possible cases...
------

keywords: script javascript vbscript com object byref by reference outbound parameter



Comments: Post a Comment

Home