ActiveX : How to change implementation from Qt to wxWidgets

78 Views Asked by At

I was using QAxWidget to access an ActiveX control. I am trying to move to wxActiveXContainer. My initial Qt code was quite simple in syntax. I am struggling to obtain something somewhat equivalent with wxWidgets. I have gone through excel and pdf example. I am still unable to connect to the ActiveX with wxActiveXContainer. I am coding in C++ on VS2019.

Here is my initial Qt code. The str output contained everything I needed to complete my needs.

#include "sc_samlight_client_ctrl_type_lib.h"
    QAxWidget actX(this);
    actX.setVisible(false);
    actX.setControl(QUuid(__uuidof(ScSamlightClientCtrl)).toString());

    QString str = actX.generateDocumentation();

Here is what I have started for wxWidgets

#include <wx/wx.h>
#include "wx/msw/ole/activex.h"
#include "wx/msw/ole/automtn.h" 
#include "sc_samlight_client_ctrl_type_lib.h"

    wxWindow* parent; // from caller...

// This seems to connect to something...
    wxAutomationObject ao;
    ao.CreateInstance(wxS("SCAPS.ScSamlightClientCtrl"));

// This does not work... I realy don't know what to pass as third argument. I am not even sure about the second one...
    wxActiveXContainer* m_pAX;
    m_pAX = new wxActiveXContainer(parent, __uuidof(ScSamlightClientCtrl), NULL);

The "sc_samlight_client_ctrl_type_lib.h" is the interface given with the equipement/program I want to control.

The real question is : for any ActiveX, using wxWidgets, how can I connect to it and obtain its interface documentation.

1

There are 1 best solutions below

3
VZ. On

wxActiveXContainer is for embedding an ActiveX window inside wxWidgets application and I am not sure you need it at all here.

Have you tried just using ao.CallMethod("generateDocumentation")?