[Interest] [ActiveX] How to use QAxAggregated with multiple interfaces?

Denis Shienkov denis.shienkov at gmail.com
Tue Jul 29 15:37:31 CEST 2014


Hi all.

>From the documentation on Qt ActiveX framework it is unclear how to use
(aggregate) a multiple interfaces.

For example, my ActiveX Server uses COM objects with two interfaces:
ICredentialProvider && ICredentialProviderCredential. To me it is unclear
how to me bind and to aggregate these two interfaces by means of
QAxAggregated and QAxBindable.

I can make it only for one interface, for example for ICredentialProvider:
...
...
class MyBindabObject : public QObject, public QAxBindable
{
    Q_OBJECT
public:
    MyBindabObject (QObject *parent = 0) {}
    ~MyBindabObject () {}

    QAxAggregated *createAggregate()
    {
        return new CredentialProviderImpl();
    }
}
...
...
class CredentialProviderImpl
        : public QAxAggregated
        , public ICredentialProvider
{
public:
    ...
    ...
    long queryInterface(const QUuid &iid, void **iface)
    {
        static const QITAB qitab[] = {
            QITABENT(CredentialProviderImpl, ICredentialProvider), {0}
        };
        return ::QISearch(this, qitab, iid, iface);
    }
    ...
    ...
}

QAXFACTORY_DEFAULT(
        MyBindabObject,
...
...
...
        )

But, in this case I need to use still objects from
ICredentialProviderCredential. In principle, I can realize a separate
wrapper:

class CredentialImpl : public ICredentialProviderCredential
{
public:
    ...
    ...
    QueryInterface(..)
    AddRef();
    Release();
    ...
}

But in this case I should re-implement the methods QueryInterface, Addref,
Release (and also to increment/decrement of the "reference counter")
manually.

Thus, whether it is possible to use the class QAxAggregated for several
interfaces?

e.g. to be available this code:

    long queryInterface(const QUuid &iid, void **iface)
    {
        if (iid == IID_MyIface1)
            return .. MyIface1;
        if (iid == IID_MyIface2)
            return .. MyIface2;
        if (iid == IID_MyIfaceN)
            return .. MyIfaceN;
    }

???

BR,
Denis
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20140729/d31a98b2/attachment.html>


More information about the Interest mailing list