COM Object desactivated
-
Re. why it's dimmed, perhaps you're running on a 64-bit Windows version?
If yes, then you have to do a regsvr32.exe twice, one for 32-bit registration and one for 64-bit registration, like this:C:\Windows\SysWOW64\regsvr32.exe dctl.ocx C:\Windows\System32\regsvr32.exe dctl.ocx
-
Thanks @hskoglund for the answer, I'am using 64-bit windows version And I registred the dctl.ocx as you showed me but it doesn't work
-
Hi again, googled a bit and verified that 32-bit OCX controls cannot be displayed/used from a 64-bit .exe file. So you have to split up you app somehow.
One way could be to keep as much as possible in your 64-bit app, and then build a 32-bit .exe Qt out-of-process ActiveX server (which just has a QMainWindow for showing the .OCX control.) For creating the ActiveX server you can use QAXContainer
Your ActiveX server would still have ti 32-bit to be able to host the dctl.ocx control, but because it's a standalone .exe server, you can communicate with it through QAxObject from your 64-bit main app :-)
-
Hi @hskoglund ! Thank you for helping me, I tried to use the 32-bit version of 5.12 MinGW to test but I'm still getting the ocx desactivated.
-
I tries again using the 32-bits version and I converted the OCX into .cpp and .h so as to integrated to Qt. And now it works :
#include "mainwindow.h" #include <QApplication> #include "ocx1lib.h" #include <QDebug> #include "combaseapi.h" using namespace OCX1Lib; int main(int argc, char *argv[]) { QApplication a(argc, argv); Dctl readObj; readObj.SetEnabled(false); readObj.SetLinkTopic("ncdde|ncu840d"); qDebug() << "LinkTopic : " << readObj.LinkTopic(); readObj.SetLinkItem("/Channel/Parameter/R[15]"); qDebug() << "LinkItem : " << readObj.LinkItem(); readObj.SetData("7"); readObj.SetEnabled(true); readObj.SetLinkCmd(CmdPoke); //MainWindow w; //w.show(); //return a.exec(); return 0; }