我想用invoke调用一个方法。我的对象输入是一个字符串,它是我计算机中文件的地址,输出类型是IDispatch。我应该如何定义Disparams作为调用的输入。我的代码是:
::CLSIDFromProgID(OLESTR("SGNSAutomation.SGNSApplication"), &clsid);
IID iid;
HRESULT hr = CoCreateInstance(clsid, NULL, CLSCTX_ALL,
IID_IDispatch, (LPVOID*)&pWMPDispatch);
IDispatch * pdisp = (IDispatch *)NULL;
DISPID dispid;
DISPPARAMS params= {NULL,NULL,0,0};
OLECHAR * Name = OLESTR("importCase");
//my problem is here
params.rgvarg[1].pdispVal
params.rgvarg[0].bstrVal="E:\\new library\\university\\final project
documentation\\GPNS project\\net1.gpns";
params.rgvarg[1].scode = DISP_E_PARAMNOTFOUND;
params.cArgs = 2;
params.cNamedArgs = 0;
//
pWMPDispatch->GetIDsOfNames(IID_NULL,
&Name,1,LOCALE_SYSTEM_DEFAULT,&dispid);
HRESULT hresult =pWMPDispatch->Invoke(dispid, IID_NULL,
LOCALE_USER_DEFAULT, DISPATCH_METHOD, ¶ms, NULL, NULL,
NULL);
请帮我正确定义瑕疵。