Make it
OLECHAR* names[] =
{
OLESTR("myMethod"),
OLESTR("szFirstParam")
Quote:
};
DISPID dispids[2];
hresult = pdisp->GetIDsOfNames( IID_NULL, names, 2, LOCALE_USER_DEFAULT,
dispids);
But really, you do not need DISPIDs of the parameters to call Invoke.
You can always pass parameters by position. Named parameters are needed
in some languages - e.g. VB allows syntax similar to
MethodName paramName1:123 paramName2:"abc"
where the caller does not know the number and order of parameters to
MethodName, but instead passes them by name.
--
With best wishes,
Igor Tandetnik
"For every complex problem, there is a solution that is simple, neat,
and wrong." H.L. Mencken
Quote:
> Hello,
> I'm trying to dinamically read a COM objects' methods and parameters
list at
> run time, in order to later place an Invoke() call.
> Using GetIDsOfNames, I can get the method's DISPID, which I can then
use in
> Invoke (and this is working); however, reading documentation for
> GetIDsOfNames lets me understand I should be able to extract the
method's
> parameters list, with a single call to GetIDsOfNames in which I am to
pass
> an array of names (right?).
> I tried the following, but am not able to understand how to extract
info
> about parameters (I just want parameters names, so that I can later
parse
> values into a DISPPARAMS structure):
> DISPID dispidParam;
> OLECHAR FAR* szParam = {L"myMethod\0szFirstParam"};
> hresult = pdisp->GetIDsOfNames( IID_NULL, &szParam, 1,
LOCALE_USER_DEFAULT,
Quote:
> &dispidParam);
> "myMethod" is the method name, while "szFirstParam" is the first (and
only)
> parameter name.
> Not sure this is ok.. I actually tested much with:
> DISPID dispidParam;
> OLECHAR FAR* szParam = L"myMethod";
> hresult = pdisp->GetIDsOfNames( IID_NULL, &szParam, 1,
LOCALE_USER_DEFAULT,
Quote:
> &dispidParam);
> assuming GetIDsOfNames should return info for the method and its
parameters;
> however, dispidParam appears to hold a DISPID for the method only
(later
> call to Invoke is successfull).
> Can anybody point me to the right direction?
> Thank you,
> AL.