Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. guide to use Active Qt to create ocx file for windowse.
Forum Updated to NodeBB v4.3 + New Features

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

Scheduled Pinned Locked Moved Unsolved General and Desktop
activeqt
3 Posts 2 Posters 3.0k Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    MhM93
    wrote on 20 Aug 2016, 04:57 last edited by
    #1

    Hi.I want to create OCX ( com object ). when I read this article : http://doc.qt.io/qt-5/activeqt-index.html 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.)

    H.Ghassami

    1 Reply Last reply
    0
    • M Offline
      M Offline
      mrjj
      Lifetime Qt Champion
      wrote on 20 Aug 2016, 08:41 last edited by
      #2

      Hi
      As far as I know, u want the QAxServer
      I have not seen many samples but this one explains a bit
      http://www.bogotobogo.com/cplusplus/files/c-gui-programming-with-qt-4-2ndedition.pdf
      Using ActiveX on Windows
      They make a small com object and show in browser.

      Its almost the same as the
      http://doc.qt.io/qt-5/activeqt-activeqt-simple-example.html

      1 Reply Last reply
      0
      • M Offline
        M Offline
        MhM93
        wrote on 20 Aug 2016, 09:15 last edited by
        #3

        @mrjj thank you for answer. I read that book but I did not get anything.
        I do like this site and make an example: http://nickguthrie.com/embedd_gui/src/qt-everywhere-opensource-src-4.8.4/doc/html/activeqt-server.html
        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 \
            test.cpp
        
        HEADERS  += mainwindow.h \
            test.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;
                w.show();
            }
        
        
            return a.exec();
        }
        
        

        then create a class and its name is test.
        test.h:

        #ifndef TEST_H
        #define TEST_H
        
        #include <QObject>
        #include <QAxBindable>
        #include <QWidget>
        #include <QAxFactory>
        
        class test : public QObject , public QAxBindable
        {
            Q_OBJECT
            Q_PROPERTY( int value READ value WRITE setValue )
        
        
            QAXFACTORY_BEGIN("{3304a730-4230-4a82-ab61-334a2e93c803}",
                              "{23667206-d900-4f1a-a14f-30397fa5adc7}")
                 QAXCLASS(MyWidget)
                 QAXCLASS(MyWidget2)
                 QAXTYPE(MySubType)
             QAXFACTORY_END()
        public:
            explicit test(QObject *parent = 0);
            int value() const;
        
        signals:
            void valueChange ( int a);
        
        public slots:
            void setValue (int a);
        
        private:
            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)
        {
            val=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?

        H.Ghassami

        1 Reply Last reply
        0

        1/3

        20 Aug 2016, 04:57

        • Login

        • Login or register to search.
        1 out of 3
        • First post
          1/3
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved