描述:
对象是Adobe reader7.0。
#import "D:\Program Files\Adobe reader7.0\ActiveX\AcroPDF.dll"
CoInitialize(NULL);
HRESULT hr;
CLSID clsid;
Acrobat::CAcroAppPtr ptr;
hr=CLSIDFromProgID(OLESTR("AcroExch.App"),&clsid);
hr=CoCreateInstance(clsid,NULL,CLSCTX_SERVER,IID_IUnknown,(void**)&ptr);
ptr->QueryInterface(__uuidof(Acrobat::CAcroApp),(void**)&ptr); ------(1)
ptr->Exit();
执行到(1)之前都没问题,acrobat.exe也已经开始运行了。但是执行到(1)时,出现了下面的错误:
Unhandled exception in sigWave.exe(KERNEL32.DLL):0xE6D7363:Microsoft C++ Exception.
我真的不知道该怎么得到接口的指针,望高手赐教.
解决方案1:
CAcroAppPtr ptr;
HRESULT hr=ptr.CreateInstance("AcroExch.App");
if(FAILED(hr)){
MessageBox("Failure");
}
ptr->Show();
//ptr->Exit();
这样也会错???