How set session variable using IDISPATCH

Aug 06, 2005 0 Replies

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


Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required