How set session variable using IDISPATCH

Since MS cannot make QSRules binary compatible between service packs I am trying to late bind my C++ code through Idispatch. I can make everything work except setting the session variable. When I make the call using my code I always get "parameter not found"

The idl is: [id(0x68030020), propput] HRESULT Variable([in, out] long* I, [in, out] VARIANT* );

And my attempt at the call is:

long lngSessionVarNum = 1;

VARIANT msg; VariantInit(&msg); msg.vt = VT_BSTR;; msg.bstrVal = L"Hello World";

CComVariant varVal1,varVal2;

varVal2.SetByRef(&msg); varVal1.SetByRef(&lngSessionVarNum);

CComVariant varArgs[2] = { varVal2, varVal1 };

DISPPARAMS dispparams = { &varArgs[0], NULL, 2, 0};

hr = m_oServer->Invoke(dispid, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_PROPERTYPUTREF, &dispparams, NULL, NULL, NULL);

This always returns parameter not found. I have also tried DISPATCH_PROPERTYPUT and that does not work either.

Thanks

KB

Reply to
Ken B
Loading thread data ...

BeanSmart website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.