<?xml version="1.0" encoding="iso-8859-1"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <!-- /tmp/qt-4.2.1-harald-1161357942206/qt-x11-opensource-src-4.2.1/src/activeqt/control/qaxbindable.cpp --> <head> <title>Qt 4.2: QAxAggregated Class Reference</title> <link href="classic.css" rel="stylesheet" type="text/css" /> </head> <body> <table border="0" cellpadding="0" cellspacing="0" width="100%"> <tr> <td align="left" valign="top" width="32"><a href="http://www.trolltech.com/products/qt"><img src="images/qt-logo.png" align="left" width="32" height="32" border="0" /></a></td> <td width="1"> </td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a> · <a href="classes.html"><font color="#004faf">All Classes</font></a> · <a href="mainclasses.html"><font color="#004faf">Main Classes</font></a> · <a href="groups.html"><font color="#004faf">Grouped Classes</font></a> · <a href="modules.html"><font color="#004faf">Modules</font></a> · <a href="functions.html"><font color="#004faf">Functions</font></a></td> <td align="right" valign="top" width="230"><a href="http://www.trolltech.com"><img src="images/trolltech-logo.png" align="right" width="203" height="32" border="0" /></a></td></tr></table><h1 align="center">QAxAggregated Class Reference<br /><sup><sup>[<a href="qaxserver.html">QAxServer</a> module]</sup></sup></h1> <p>The QAxAggregated class is an abstract base class for implementations of additional COM interfaces. <a href="#details">More...</a></p> <pre> #include <QAxAggregated></pre><ul> <li><a href="qaxaggregated-members.html">List of all members, including inherited members</a></li> </ul> <a name="public-functions"></a> <h3>Public Functions</h3> <ul> <li><div class="fn"/>virtual long <b><a href="qaxaggregated.html#queryInterface">queryInterface</a></b> ( const QUuid & <i>iid</i>, void ** <i>iface</i> ) = 0</li> </ul> <a name="protected-functions"></a> <h3>Protected Functions</h3> <ul> <li><div class="fn"/>virtual <b><a href="qaxaggregated.html#dtor.QAxAggregated">~QAxAggregated</a></b> ()</li> <li><div class="fn"/>IUnknown * <b><a href="qaxaggregated.html#controllingUnknown">controllingUnknown</a></b> () const</li> <li><div class="fn"/>QObject * <b><a href="qaxaggregated.html#object">object</a></b> () const</li> <li><div class="fn"/>QWidget * <b><a href="qaxaggregated.html#widget">widget</a></b> () const</li> </ul> <a name="details"></a> <hr /> <h2>Detailed Description</h2> <p>The QAxAggregated class is an abstract base class for implementations of additional COM interfaces.</p> <p>Create a subclass of QAxAggregated and reimplement <a href="qaxaggregated.html#queryInterface">queryInterface</a>() 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 <tt>QueryInterface()</tt>, <tt>AddRef()</tt> and <tt>Release()</tt> to the interface provided by <a href="qaxaggregated.html#controllingUnknown">controllingUnknown</a>().</p> <p>Use the <a href="qaxaggregated.html#widget">widget</a>() method if you need to make calls to the <a href="qwidget.html">QWidget</a> implementing the ActiveX control. You must not store that pointer in your subclass (unless you use <a href="qpointer.html">QPointer</a>), as the <a href="qwidget.html">QWidget</a> can be destroyed by the <a href="activeqt.html#activeqt">ActiveQt</a> framework at any time.</p> <p>See also <a href="qaxbindable.html">QAxBindable</a>, <a href="qaxfactory.html">QAxFactory</a>, and <a href="activeqt.html">ActiveQt Framework</a>.</p> <hr /> <h2>Member Function Documentation</h2> <h3 class="fn"><a name="dtor.QAxAggregated"></a>QAxAggregated::~QAxAggregated () <tt> [virtual protected]</tt></h3> <p>The destructor is called internally by Qt.</p> <h3 class="fn"><a name="controllingUnknown"></a>IUnknown * QAxAggregated::controllingUnknown () const <tt> [protected]</tt></h3> <p>Returns the <tt>IUnknown</tt> interface of the ActiveX control. Implement the <tt>IUnknown</tt> interface in your <a href="qaxaggregated.html">QAxAggregated</a> subclass to delegate calls to <tt>QueryInterface()</tt>, <tt>AddRef()</tt>, and <tt>Release()</tt> to the interface provided by this function.</p> <pre> HRESULT AxImpl::QueryInterface(REFIID iid, void **iface) { return controllingUnknown()->QueryInterface(iid, iface); } ulong AxImpl::AddRef() { return controllingUnknown()->AddRef(); } ulong AxImpl::Release() { return controllingUnknown()->Release(); }</pre> <p>Instead of declaring and implementing these three functions manually, you can use the <tt>QAXAGG_IUNKNOWN</tt> macro in the class declaration of your subclass.</p> <h3 class="fn"><a name="object"></a><a href="qobject.html">QObject</a> * QAxAggregated::object () const <tt> [protected]</tt></h3> <p>Returns a pointer to the <a href="qobject.html">QObject</a> subclass implementing the COM object. This function might return 0.</p> <p><b>Warning:</b> You must not store the returned pointer, unless you use a <a href="qpointer.html">QPointer</a>, since the <a href="qobject.html">QObject</a> can be destroyed by <a href="activeqt.html#activeqt">ActiveQt</a> at any time.</p> <h3 class="fn"><a name="queryInterface"></a>long QAxAggregated::queryInterface ( const <a href="quuid.html">QUuid</a> & <i>iid</i>, void ** <i>iface</i> ) <tt> [pure virtual]</tt></h3> <p>Reimplement this pure virtual function to support additional COM interfaces. Set the value of <i>iface</i> to point to this object to support the interface <i>iid</i>. Note that you must cast the <tt>this</tt> pointer to the appropriate superclass.</p> <pre> 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; }</pre> <p>Return the standard COM results <tt>S_OK</tt> (interface is supported) or <tt>E_NOINTERFACE</tt> (requested interface is not supported).</p> <p><b>Warning:</b> Even though you must implement the <tt>IUnknown</tt> interface if you implement any COM interface you must not support the <tt>IUnknown</tt> interface in your queryInterface() implementation.</p> <h3 class="fn"><a name="widget"></a><a href="qwidget.html">QWidget</a> * QAxAggregated::widget () const <tt> [protected]</tt></h3> <p>Returns a pointer to the <a href="qwidget.html">QWidget</a> subclass implementing the ActiveX control. This function might return 0.</p> <p><b>Warning:</b> You must not store the returned pointer, unless you use a <a href="qpointer.html">QPointer</a>, since the <a href="qwidget.html">QWidget</a> can be destroyed by <a href="activeqt.html#activeqt">ActiveQt</a> at any time.</p> <p /><address><hr /><div align="center"> <table width="100%" cellspacing="0" border="0"><tr class="address"> <td width="30%">Copyright © 2006 <a href="trolltech.html">Trolltech</a></td> <td width="40%" align="center"><a href="trademarks.html">Trademarks</a></td> <td width="30%" align="right"><div align="right">Qt 4.2.1</div></td> </tr></table></div></address></body> </html>