Important: Please read the Qt Code of Conduct -

guide to use Active Qt to create ocx file for windowse.

  • Hi.I want to create OCX ( com object ). when I read this article : I found there are two type of active qt.
    QAxContainer and QAxServer.
    My purpose is to make OCX file .I have a TCP class make client to connect to server and read data and write data in LAN network.I want this OCX can attach to any application. (like Delphi or other program language).
    This class functions are: connect to server , read data from server and send it to application by output and write data on network by getting data from input.

    I wand to change this class to OCX file to attach to any applications. I do not know which one is select? (QAxContainer and QAxServer.)

  • Lifetime Qt Champion

    As far as I know, u want the QAxServer
    I have not seen many samples but this one explains a bit
    Using ActiveX on Windows
    They make a small com object and show in browser.

    Its almost the same as the

  • @mrjj thank you for answer. I read that book but I did not get anything.
    I do like this site and make an example:
    1- create widget application. (first made by console app but the Qt creator alert show it is not good in console app so I create widget app)

    2- in .pro :

    # Project created by QtCreator 2016-08-20T12:52:04
    QT       += core gui
    greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
    TARGET = Test2ActiveXServer
    TEMPLATE = app
    SOURCES += main.cpp\
            mainwindow.cpp \
    HEADERS  += mainwindow.h \
    FORMS    += mainwindow.ui
    #this is make QAXserver
    CONFIG  += axserver
    RC_FILE  = qaxserver.rc

    in main.cpp:

    #include "mainwindow.h"
    #include <QApplication>
    #include <QAxFactory>
    int main(int argc, char *argv[])
        QApplication a(argc, argv);
        if ( !QAxFactory::isServer() )
            MainWindow w;
        return a.exec();

    then create a class and its name is test.

    #ifndef TEST_H
    #define TEST_H
    #include <QObject>
    #include <QAxBindable>
    #include <QWidget>
    #include <QAxFactory>
    class test : public QObject , public QAxBindable
        Q_PROPERTY( int value READ value WRITE setValue )
        explicit test(QObject *parent = 0);
        int value() const;
        void valueChange ( int a);
    public slots:
        void setValue (int a);
        int *val;
    #endif // TEST_H

    and test.cpp :

    #include "test.h"
    test::test(QObject *parent) : QObject(parent)
    int test::value() const
        return val;
    void test::setValue(int a)
        emit valueChange(val);

    after that I dont know what am I do?
    when run qmake just the qmake file create. when I build the project it shows me this error:

    :-1: error: dependent '..\Test2ActiveXServer\qaxserver.rc' does not exist.

    in that doc it says : "To build the ActiveX server executable run qmake to generate the makefile, and use your compiler's make tool as for any other Qt application. The make process will also register the controls in the system registry by calling the resulting executable with the -regserver command line option." . I don't understand it.
    My question is :
    Is that project is Active x server?
    How to test it?
    what am I do know?
    How does it work?

Log in to reply