preparing DISPPARAMS for a method??
-
hi I am writing an IDispatch client. i want to call this method void SomeMethod( [in, out] BSTR* strFile, [in, out] BSTR* strMiscFile, [in, out, optional, defaultvalue("Some Default value")] BSTR* strValue ); using IDispatch::Invoke. I have got DISPID of this method using GetIDsOfNames, the problem is in making DISPPARAMS for this method that can be passed to Invoke. does any one know how do we prepare DISPPARAMS for such type of methods as mentioned above. Thanks in anticipation Azam
-
hi I am writing an IDispatch client. i want to call this method void SomeMethod( [in, out] BSTR* strFile, [in, out] BSTR* strMiscFile, [in, out, optional, defaultvalue("Some Default value")] BSTR* strValue ); using IDispatch::Invoke. I have got DISPID of this method using GetIDsOfNames, the problem is in making DISPPARAMS for this method that can be passed to Invoke. does any one know how do we prepare DISPPARAMS for such type of methods as mentioned above. Thanks in anticipation Azam
CComBSTR strFile, strMiscFile, strValue; VARIANTARG* rgvarg = new VARIANTARG[3]; V_VT(&rgvarg[2]) = VT_BSTR | VT_BYREF; V_BSTRREF(&rgvarg[2]) = &strFile; V_VT(&rgvarg[1]) = VT_BSTR | VT_BYREF; V_BSTRREF(&rgvarg[1]) = &strMiscFile; V_VT(&rgvarg[0]) = VT_BSTR | VT_BYREF; V_BSTRREF(&rgvarg[0]) = &strValue; DISPPARAMS dispparams = { rgvarg, NULL, 3, 0 }; With best wishes, Vita
-
CComBSTR strFile, strMiscFile, strValue; VARIANTARG* rgvarg = new VARIANTARG[3]; V_VT(&rgvarg[2]) = VT_BSTR | VT_BYREF; V_BSTRREF(&rgvarg[2]) = &strFile; V_VT(&rgvarg[1]) = VT_BSTR | VT_BYREF; V_BSTRREF(&rgvarg[1]) = &strMiscFile; V_VT(&rgvarg[0]) = VT_BSTR | VT_BYREF; V_BSTRREF(&rgvarg[0]) = &strValue; DISPPARAMS dispparams = { rgvarg, NULL, 3, 0 }; With best wishes, Vita
hi Vita Thank you very much for solving my problem. One thing i would also like to ask if you donot mind, how do we pass named parametrs to a function. lets say if the function is same as mentioned in my previous question i.e void SomeMethod( [in, out] BSTR* strFile, [in, out] BSTR* strMiscFile, [in, out, optional, defaultvalue("Some Default value")] BSTR* strValue ); then how do v prepare DISPPARAMS for this function using named arguments? thanks in anticipation Azam
-
hi Vita Thank you very much for solving my problem. One thing i would also like to ask if you donot mind, how do we pass named parametrs to a function. lets say if the function is same as mentioned in my previous question i.e void SomeMethod( [in, out] BSTR* strFile, [in, out] BSTR* strMiscFile, [in, out, optional, defaultvalue("Some Default value")] BSTR* strValue ); then how do v prepare DISPPARAMS for this function using named arguments? thanks in anticipation Azam
-
Look at Automation: Passing Parameters[^] But I don't recommend you to use the named arguments. With best wishes, Vita
Thanks once again. i will read this article. may i distrub u if i need some help in between :) regards Azam