Calling a CAPL function from QT using com and Canalyzr

Status
Not open for further replies.

hichemm

Newbie level 3
Joined
Feb 13, 2015
Messages
3
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
28
I want to call a function from QT application in fact this function executet a CAPL script runing in Canalyzer I am using COM to get access to the function here my exemple but it doesnt work where is the problem any help plz


Code C++ - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
ICAPL *pcapl;
 
ICAPLFunction *fn ;
 IApplication* pIApp;
 
 
HRESULT result,result1,result2, hresult,result3,result4,hr;
 IDispatch*CaplDisp,*CaplFn;
WCHAR * szMember = L"Multiply";
 DISPID dispid;
  DISPPARAMS dispparams = {NULL, NULL, 0, 0};
    EXCEPINFO excepinfo;
      UINT nArgErr;
   CLSID clsid;
 
 
 
 result = CLSIDFromProgID(L"CANalyzer.Application", &clsid);
   const  IID IID_CAPL =__uuidof(ICAPL);
 
    const  IID IID_CAPLFUNCTION =__uuidof(ICAPLFunction);
     const IID IID_IApplication =__uuidof(IApplication);
 
   result = CoCreateInstance(clsid, NULL, CLSCTX_LOCAL_SERVER, IID_IApplication, (void**) &pIApp);
 
 
   result1=pIApp->get_CAPL(&CaplDisp);
 
               qDebug() << "Result_get_CAPL "<<result1 ;
 
 
   result2=CaplDisp->QueryInterface(IID_CAPL,(void**)&pcapl);
    qDebug() << "result2 "<<result2 ;
 
 
  VARIANT varResult;
 
 
  hr = CaplDisp->GetIDsOfNames(IID_CAPLFUNCTION, &szMember, 1, CLSCTX_LOCAL_SERVER, &dispid);
    qDebug() << "hr"<<hr ;
    if (SUCCEEDED(hr)) {
hr = CaplDisp->Invoke(1,IID_CAPL, CLSCTX_LOCAL_SERVER,DISPATCH_METHOD,&dispparams, &varResult, NULL, NULL);
    }

 
Last edited by a moderator:

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…