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. Using an ActiveX control without GUI ?
Forum Update on Monday, May 27th 2025

Using an ActiveX control without GUI ?

Scheduled Pinned Locked Moved General and Desktop
5 Posts 3 Posters 5.9k Views
  • 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.
  • K Offline
    K Offline
    Koann
    wrote on 21 Jun 2011, 21:27 last edited by
    #1

    Hi everyone,

    I started developping an application for controlling motorized stages a while ago under Qt with Visual Studio, and I now face a strange problem.

    One of the stages constructor only provides an ActiveX tool for controlling its devices. I can put this tool into a QAxWidget on my GUI, and then send it commands programmatically or use the input widgets inside the ActiveX box. But I'd like only to have access programmatically to this control. The workaround I used until now is to put the QWidget on an hidden page of a QStackedWidget, but I would like to put it in a different class than my GUI, and even a different thread because the interface freezes while the stages are working.

    Is there a way to instantiate a ActiveX control without putting it into a GUI ?

    Thanks,

    Romain

    1 Reply Last reply
    0
    • G Offline
      G Offline
      giesbert
      wrote on 22 Jun 2011, 06:22 last edited by
      #2

      Hi Koann,

      an ActiveX control is a UI COM object. UI means, it has some UI to display. Theoretically, you can instantiate it like each other server COM object, but then not as ActiveX control, try CoCreateInstance(), it will work and you will get valid pointers. But whether the object will work as expected, I can't tell, es the windows of the active X will not be created.

      If you use QAxWidget to create the object, you are bound to the main thread! And also, creating the object from another thread with CoCreateInstance will only have partly success, as it depends on the appartement model of the created object, where it will be created and how it can be used.

      Nokia Certified Qt Specialist.
      Programming Is Like Sex: One mistake and you have to support it for the rest of your life. (Michael Sinz)

      1 Reply Last reply
      0
      • K Offline
        K Offline
        Koann
        wrote on 28 Jun 2011, 16:34 last edited by
        #3

        Thank you Gerolf for your explanation,

        All of the methods that I'd like to use on the ActiveX control have an option for being non-blocking, so even using an QAxWidget there is no more UI freezing problem. I still wanted to try the CoCreateInstance() method, and I'm having trouble with the includes of my project. I scanned the ActiveX object with OLE/COM Object Viewer to find the related interfaces, and I am know trying to access their methods using "this guide":http://netez.com/2xExplorer/shellFAQ/bg_com.html. The problem is I don't know how to make the compiler recognize the interfaces in my project. Is there a special file to include ? The only one that is related to the ActiveX control on my computer is an .ocx file.

        For the QAxWidget solution, I experience another problem. I can access the methods of the control itself with dynamicCall() methods, but right now I'm trying to listen to events that are being fired by the controller whenever the stage stops for example. The code I'm using is based on this "doc page":http://doc.qt.nokia.com/qq/qq03-activex.html. It is the following :
        @
        xMotor = new QAxWidget(this);
        xMotor->setControl("{3CE35BF3-1E13-4D2C-8C0B-DEF6314420B3}");
        // Set the serial number of the stage
        xMotor->dynamicCall("setHWSerialNum(long)", 90825074);
        //Connect the event to a Qt slot in this class
        connect(xMotor, SIGNAL(MoveStopped(long)), this, SLOT(updatePositionData()));
        xMotor->dynamicCall("startCtrl()"); // Starts the stage
        // Test method, that moves the stage to a position of 50
        xMotor->dynamicCall("moveAbsoluteEx(long, float, float, bool)", 0, (float) 50, 0 , 0); @

        With this code, the stages moves correctly, but the compilers says :
        @No such signal QAxWidget::MoveStopped(long)@
        Is there a way to listen to the events of the controller ?

        Thanks

        1 Reply Last reply
        0
        • G Offline
          G Offline
          giesbert
          wrote on 28 Jun 2011, 18:33 last edited by
          #4

          Hi Koann,

          the COM guide you used is used for server objects. To create activeX objects (which typically have a UI).
          If you want to use the interfaces inside your app, you can use #import on the dll/tlb containing the interfaces (if you use the Microsoft toolchain).

          Nokia Certified Qt Specialist.
          Programming Is Like Sex: One mistake and you have to support it for the rest of your life. (Michael Sinz)

          1 Reply Last reply
          0
          • C Offline
            C Offline
            Ckico
            wrote on 31 Jan 2013, 10:45 last edited by
            #5

            Hey VideoCapX is a activex control software, i am using it 3 years already and it works fine for me.

            1 Reply Last reply
            0

            • Login

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