1

Currently, I have an 'xyz.ocx' file and want to call its functions.

As I mentioned in the title, I succeeded calling its function using PyQt5.5.1 and Python 3.4.4. Here's the following code.

from PyQt5.QAxContainer import QAxWidget
from PyQt5.QtWidgets import QApplication
if __name__ == "__main__":
    app = QApplication([])
    ocx = QAxWidget("myclsid....")  # ActiveXControl Object
    ocx.dynamicCall("somemethod()") # It worked. Some dialog opened by this function.
    app.exec_()

However, when I do the exactly same thing with Qt5.7.0 and VS2015, I get nothing(no error, no proper execution of function, just nothing). Here's the following code I tried.

#include <QAxWidget.h>
#include <QtWidgets/QApplication>
#include <stdio.h>
#include <windows.h>
int main(int argc, char *argv[])
{
    QApplication a(argc, argv);

    QAxWidget* ocx = new QAxWidget("myclsid...")
    ocx->dynamicCall("somemethod()"); 

// Nothing happened. 
// No error, no dialog appeared(dialog should be appeared by this function). 
// And also the weird thing is the same thing happened(no error, just nothing) 
// even I called some non-existing function such as dynamicCall("fuiwhfueohiwuohfewlfae()")
// (no "No Such Property" error occured)

    return a.exec();
}

As I commented, nothing happend when I call the dynamicCall(somemethod()) unlike above python & pyqt example. Since I'm a novice to qt, I can't really figure out what's going on with my C++&Qt code. Is there any possible reason of my C++ & Qt code not working? How can I solve this?

Any suggestions or helps are greatly appreciated. Thanks.

+++ ADDED

I just realized that my pyqt5.5.1 was 32bit pyqt and qt5.7.0 was 64bit pyqt, and my ocx file is 32bit. Is there a possibility that this caused a problem?

asqdf
  • 289
  • 2
  • 9

0 Answers0