Qt ActiveX CoCreateInstance失败(未注册类)Adobe Reader

时间:2016-11-09 19:13:45

标签: c++ qt com activex acrobat

我从qt wiki上读到的内容中得到以下代码:

auto pdfObject = new QAxObject("AxAcroPDFLib.AxAcroPDF");
qDebug() << pdfObject->dynamicCall("LoadFile(const QString)", "test.pdf");
qDebug() << pdfObject->dynamicCall("Print()");

但是当我运行它时,我收到了消息:

CoCreateInstance failure (Class not registered)
QAxBase::setControl: requested control AxAcroPDFLib.AxAcroPDF could not be instantiated

我搜索了AcroPDF.dll所需的dll,并在C:\Program Files (x86)\Common Files\Adobe\Acrobat\ActiveX中找到并安装了Adobe Acrobat Reader DC。我能做些什么使这个有效?

1 个答案:

答案 0 :(得分:0)

由于缺少注册,可能找不到COM对象。确保已注册ActiveX DLL。使用regsvr32。您可能需要管理员权限才能运行它。命令行是:

regsvr32 AcroPDF.dll
相关问题