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. Help with using QAxAggregated
Forum Updated to NodeBB v4.3 + New Features

Help with using QAxAggregated

Scheduled Pinned Locked Moved General and Desktop
1 Posts 1 Posters 549 Views 1 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.
  • A Offline
    A Offline
    antoshib
    wrote on last edited by
    #1

    Hi all.
    Please help with using QAxAggregated.
    I need to build in-proc COM server dll, with inheritance of existing interface provided in TLB file.
    I make something like the "OpenGL Example (ActiveQt)":http://qt-project.org/doc/qt-4.8/activeqt-opengl.html, and successfully compile code.
    But client cannot see any method from inherited interface. How to access them?
    @
    // plugapi.cpp
    //...
    #import "GAPI.tlb" no_implementation
    using namespace GAPI;
    //....
    // inheritance from external interface IPluginOutside from TLB
    //
    class AxPluginOutsideImpl : public QAxAggregated, public IPluginOutside {
    public:
    AxPluginOutsideImpl() {}

    long queryInterface(const QUuid &iid, void **iface);
    QAXAGG_IUNKNOWN
    
    BSTR STDMETHODCALLTYPE Get_Name(void);
    BSTR STDMETHODCALLTYPE Get_Version(void);
    uint STDMETHODCALLTYPE ExecuteTicket(long Ticket);
    

    };

    // class which i need to expose for clients
    //
    class GQPlugin : public QObject, public QAxBindable {
    Q_OBJECT
    Q_CLASSINFO("ClassID", "{3c126a91-a880-4a42-b37c-c9041b1946bc}")
    Q_CLASSINFO("InterfaceID", "{D8D09E0D-8C9B-4590-B8F1-5C9216767093}")
    Q_CLASSINFO("EventsID", "{609c58cb-4811-4d45-bf11-a895e2349e83}")
    public:
    GQPlugin(QObject *parent = 0);

    QAxAggregated *createAggregate(){ return new AxPluginOutsideImpl(); }
    

    };
    @

    @
    // plugapi.cpp realisation
    // ...
    #import "GAPI.tlb" implementation_only
    #define QIID_IPluginOutside QUuid(__uuidof(IPluginOutside))

    GQPlugin::GQPlugin(QObject *parent): QObject(parent){}

    long AxPluginOutsideImpl::queryInterface(const QUuid &iid, void **iface){

    *iface = 0;
    
    if ( iid == QIID_IPluginOutside )
        *iface =    (IPluginOutside*) this;
    else
        return E_NOINTERFACE;
    
    AddRef();
    return S_OK;
    

    }

    BSTR STDMETHODCALLTYPE AxPluginOutsideImpl::Get_Name(void)
    { return L"GQPlugin.1.0"; }

    BSTR STDMETHODCALLTYPE AxPluginOutsideImpl::Get_Version(void)
    { return L"1.0"; }

    uint STDMETHODCALLTYPE AxPluginOutsideImpl::ExecuteTicket( long Ticket )
    { return 1; }
    @

    @
    // com server main.cpp
    // ...
    QAXFACTORY_BEGIN("{43f39e41-f171-42d9-884e-7bb029a8bb16}",
    "{a1eaf125-2906-4ff7-99ba-3c993408520a}")
    QAXCLASS(GQPlugin)
    QAXFACTORY_END()
    @

    @
    // client.cpp
    // ..
    QAxObject axgp;

    // GQPlugin class id
    axgp.setControl( "{3c126a91-a880-4a42-b37c-c9041b1946bc}" );  
    
    // trying to call method of inherited interface 
    qDebug() << axgp.dynamicCall("Get_Name");                             
    

    @

    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