0

I want to call an method with invoke. My object input is a string that is address of a file in my computer and type of output is IDispatch. How I should define Disparams as an input of invoke. My code is :

::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, &params, NULL, NULL,
                          NULL);  

please help me to define disparams correctly.

mahdi Lotfi
  • 316
  • 3
  • 13
  • 2
    How is defined the called function "importcase", exactly? – Simon Mourier Apr 18 '18 at 10:44
  • 1
    Hey, @mahdi Lotfi: I notice you've been asking a lot of COM questions lately but haven't been accepting the answers that are given to you. You might get more responses if you use StackOverflow the way that it's supposed to be used. – Michael Gunter Apr 20 '18 at 18:09
  • Excuse me i am a newbie in stack overflow and i don't know a lot about this site and accepting answers and other options. – mahdi Lotfi Apr 21 '18 at 19:19
  • i call this function in this way IDispatch out=importcase(path of the file in my computer) – mahdi Lotfi Apr 21 '18 at 19:22
  • I can answer this question, but we'll need to see the IDL or C++ that defines the interface that you're trying to use. Please update the question with this information. – Michael Gunter Apr 23 '18 at 16:10

0 Answers0