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);
} |