tdietz
asked on
Passing arguments from VBscript (VARIANT)
I am trying to call a COM object (written in C++) from VBSCRIPT embedded in an HTML page (IE 3.02). The object method's signature is: myfunc( [out] VARIANT* pVar,
[in] VARIANT ccVar )
If I call the method (from within VBSCRIPT) like this:
myfunc( str, 10000 );
(str is of VARIANT), the variant comes in (on the C++) side as VT_I4 as expected.
However, if I pass it as: myfunc( str, nNumber)
(nNumber is of VARIANT set to 10000), the incoming VARIANT (in C++) actually is a byref ptr to another variant that contains the VT_I4 with the 10000.
Why is this? Do I have to code for all situations? As I mentioned, my method expects an [in] only for the second parameter, I never want BYREF.
[in] VARIANT ccVar )
If I call the method (from within VBSCRIPT) like this:
myfunc( str, 10000 );
(str is of VARIANT), the variant comes in (on the C++) side as VT_I4 as expected.
However, if I pass it as: myfunc( str, nNumber)
(nNumber is of VARIANT set to 10000), the incoming VARIANT (in C++) actually is a byref ptr to another variant that contains the VT_I4 with the 10000.
Why is this? Do I have to code for all situations? As I mentioned, my method expects an [in] only for the second parameter, I never want BYREF.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.