QAxAggregated Class Reference |
virtual long | queryInterface ( const QUuid & iid, void ** iface ) = 0 |
virtual | ~QAxAggregated () |
IUnknown * | controllingUnknown () const |
QObject * | object () const |
QWidget * | widget () const |
The QAxAggregated class is an abstract base class for implementations of additional COM interfaces.
Create a subclass of QAxAggregated and reimplement queryInterface() to support additional COM interfaces. Use multiple inheritance from those COM interfaces. Implement the IUnknown interface of those COM interfaces by delegating the calls to QueryInterface(), AddRef() and Release() to the interface provided by controllingUnknown().
Use the widget() method if you need to make calls to the QWidget implementing the ActiveX control. You must not store that pointer in your subclass (unless you use QPointer), as the QWidget can be destroyed by the ActiveQt framework at any time.
See also QAxBindable, QAxFactory, and ActiveQt Framework.
The destructor is called internally by Qt.
Returns the IUnknown interface of the ActiveX control. Implement the IUnknown interface in your QAxAggregated subclass to delegate calls to QueryInterface(), AddRef(), and Release() to the interface provided by this function.
HRESULT AxImpl::QueryInterface(REFIID iid, void **iface) { return controllingUnknown()->QueryInterface(iid, iface); } ulong AxImpl::AddRef() { return controllingUnknown()->AddRef(); } ulong AxImpl::Release() { return controllingUnknown()->Release(); }
Instead of declaring and implementing these three functions manually, you can use the QAXAGG_IUNKNOWN macro in the class declaration of your subclass.
Returns a pointer to the QObject subclass implementing the COM object. This function might return 0.
Warning: You must not store the returned pointer, unless you use a QPointer, since the QObject can be destroyed by ActiveQt at any time.
Reimplement this pure virtual function to support additional COM interfaces. Set the value of iface to point to this object to support the interface iid. Note that you must cast the this pointer to the appropriate superclass.
long AxImpl::queryInterface(const QUuid &iid, void **iface) { *iface = 0; if (iid == IID_ISomeCOMInterface) *iface = (ISomeCOMInterface*)this; else return E_NOINTERFACE; AddRef(); return S_OK; }
Return the standard COM results S_OK (interface is supported) or E_NOINTERFACE (requested interface is not supported).
Warning: Even though you must implement the IUnknown interface if you implement any COM interface you must not support the IUnknown interface in your queryInterface() implementation.
Returns a pointer to the QWidget subclass implementing the ActiveX control. This function might return 0.
Warning: You must not store the returned pointer, unless you use a QPointer, since the QWidget can be destroyed by ActiveQt at any time.
Cette page est une traduction d'une page de la documentation de Qt, écrite par Nokia Corporation and/or its subsidiary(-ies). Les éventuels problèmes résultant d'une mauvaise traduction ne sont pas imputables à Nokia. | Qt 4.6-snapshot | |
Copyright © 2012 Developpez LLC. Tous droits réservés Developpez LLC. Aucune reproduction, même partielle, ne peut être faite de ce site et de l'ensemble de son contenu : textes, documents et images sans l'autorisation expresse de Developpez LLC. Sinon, vous encourez selon la loi jusqu'à 3 ans de prison et jusqu'à 300 000 E de dommages et intérêts. Cette page est déposée à la SACD. | ||
Vous avez déniché une erreur ? Un bug ? Une redirection cassée ? Ou tout autre problème, quel qu'il soit ? Ou bien vous désirez participer à ce projet de traduction ? N'hésitez pas à nous contacter ou par MP ! |
Copyright © 2000-2012 - www.developpez.com