1
<?xml version="1.0" encoding="iso-8859-1"?>
3
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
4
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
5
<!-- /tmp/qt-4.0.0-espenr-1119621036935/qt-x11-opensource-desktop-4.0.0/extensions/activeqt/control/qaxfactory.cpp -->
7
<title>Qt 4.0: QAxFactory Class Reference</title>
8
<style>h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm; }
9
a:link { color: #004faf; text-decoration: none }
10
a:visited { color: #672967; text-decoration: none }
11
td.postheader { font-family: sans-serif }
12
tr.address { font-family: sans-serif }
13
body { background: #ffffff; color: black; }</style>
16
<table border="0" cellpadding="0" cellspacing="0" width="100%">
18
<td align="left" valign="top" width="32"><img src="images/qt-logo.png" align="left" width="32" height="32" border="0" /></td>
19
<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="annotated.html"><font color="#004faf">Annotated</font></a> · <a href="groups.html"><font color="#004faf">Grouped Classes</font></a> · <a href="functions.html"><font color="#004faf">Functions</font></a></td>
20
<td align="right" valign="top" width="230"><img src="images/trolltech-logo.png" align="right" width="203" height="32" border="0" /></td></tr></table><h1 align="center">QAxFactory Class Reference</h1>
21
<p>The QAxFactory class defines a factory for the creation of COM components. <a href="#details">More...</a></p>
22
<pre>#include <QAxFactory></pre><p>Part of the <a href="qaxserver.html">QAxServer</a> module.</p>
23
<p>Inherits <a href="qobject.html">QObject</a>.</p>
25
<li><a href="qaxfactory-members.html">List of all members, including inherited members</a></li>
27
<a name="public-types"></a>
30
<li><div class="fn"/>enum <b><a href="qaxfactory.html#ServerType-enum">ServerType</a></b> { SingleInstance, MultipleInstances }</li>
32
<a name="public-functions"></a>
33
<h3>Public Functions</h3>
35
<li><div class="fn"/><b><a href="qaxfactory.html#QAxFactory">QAxFactory</a></b> ( const QUuid & <i>libid</i>, const QUuid & <i>appid</i> )</li>
36
<li><div class="fn"/>virtual <b><a href="qaxfactory.html#dtor.QAxFactory">~QAxFactory</a></b> ()</li>
37
<li><div class="fn"/>virtual QUuid <b><a href="qaxfactory.html#appID">appID</a></b> () const</li>
38
<li><div class="fn"/>virtual QUuid <b><a href="qaxfactory.html#classID">classID</a></b> ( const QString & <i>key</i> ) const</li>
39
<li><div class="fn"/>virtual QObject * <b><a href="qaxfactory.html#createObject">createObject</a></b> ( const QString & <i>key</i> ) = 0</li>
40
<li><div class="fn"/>virtual bool <b><a href="qaxfactory.html#createObjectWrapper">createObjectWrapper</a></b> ( QObject * <i>object</i>, IDispatch ** <i>wrapper</i> )</li>
41
<li><div class="fn"/>virtual QUuid <b><a href="qaxfactory.html#eventsID">eventsID</a></b> ( const QString & <i>key</i> ) const</li>
42
<li><div class="fn"/>virtual QString <b><a href="qaxfactory.html#exposeToSuperClass">exposeToSuperClass</a></b> ( const QString & <i>key</i> ) const</li>
43
<li><div class="fn"/>virtual QStringList <b><a href="qaxfactory.html#featureList">featureList</a></b> () const = 0</li>
44
<li><div class="fn"/>virtual bool <b><a href="qaxfactory.html#hasStockEvents">hasStockEvents</a></b> ( const QString & <i>key</i> ) const</li>
45
<li><div class="fn"/>virtual QUuid <b><a href="qaxfactory.html#interfaceID">interfaceID</a></b> ( const QString & <i>key</i> ) const</li>
46
<li><div class="fn"/>virtual bool <b><a href="qaxfactory.html#isService">isService</a></b> () const</li>
47
<li><div class="fn"/>virtual const QMetaObject * <b><a href="qaxfactory.html#metaObject">metaObject</a></b> ( const QString & <i>key</i> ) const = 0</li>
48
<li><div class="fn"/>virtual void <b><a href="qaxfactory.html#registerClass">registerClass</a></b> ( const QString & <i>key</i>, QSettings * <i>settings</i> ) const</li>
49
<li><div class="fn"/>virtual bool <b><a href="qaxfactory.html#stayTopLevel">stayTopLevel</a></b> ( const QString & <i>key</i> ) const</li>
50
<li><div class="fn"/>virtual QUuid <b><a href="qaxfactory.html#typeLibID">typeLibID</a></b> () const</li>
51
<li><div class="fn"/>virtual void <b><a href="qaxfactory.html#unregisterClass">unregisterClass</a></b> ( const QString & <i>key</i>, QSettings * <i>settings</i> ) const</li>
52
<li><div class="fn"/>virtual bool <b><a href="qaxfactory.html#validateLicenseKey">validateLicenseKey</a></b> ( const QString & <i>key</i>, const QString & <i>licenseKey</i> ) const</li>
55
<li><div class="fn"/>28 public functions inherited from <a href="qobject.html#public-functions">QObject</a></li>
57
<a name="static-public-members"></a>
58
<h3>Static Public Members</h3>
60
<li><div class="fn"/>bool <b><a href="qaxfactory.html#isServer">isServer</a></b> ()</li>
61
<li><div class="fn"/>bool <b><a href="qaxfactory.html#registerActiveObject">registerActiveObject</a></b> ( QObject * <i>object</i> )</li>
62
<li><div class="fn"/>QString <b><a href="qaxfactory.html#serverDirPath">serverDirPath</a></b> ()</li>
63
<li><div class="fn"/>QString <b><a href="qaxfactory.html#serverFilePath">serverFilePath</a></b> ()</li>
64
<li><div class="fn"/>bool <b><a href="qaxfactory.html#startServer">startServer</a></b> ( ServerType <i>type</i> = MultipleInstances )</li>
65
<li><div class="fn"/>bool <b><a href="qaxfactory.html#stopServer">stopServer</a></b> ()</li>
68
<li><div class="fn"/>4 static public members inherited from <a href="qobject.html#static-public-members">QObject</a></li>
73
<li><div class="fn"/><b><a href="qaxfactory.html#QAXCLASS">QAXCLASS</a></b> ( <i>Class</i> )</li>
74
<li><div class="fn"/><b><a href="qaxfactory.html#QAXFACTORY_BEGIN">QAXFACTORY_BEGIN</a></b> ( <i>IDTypeLib</i>, <i>IDApp</i> )</li>
75
<li><div class="fn"/><b><a href="qaxfactory.html#QAXFACTORY_DEFAULT">QAXFACTORY_DEFAULT</a></b> ( <i>Class</i>, <i>ClassID</i>, <i>InterfaceID</i>, <i>EventID</i>, <i>LibID</i>, <i>AppID</i> )</li>
76
<li><div class="fn"/><b><a href="qaxfactory.html#QAXFACTORY_END">QAXFACTORY_END</a></b> ()</li>
77
<li><div class="fn"/><b><a href="qaxfactory.html#QAXFACTORY_EXPORT">QAXFACTORY_EXPORT</a></b> ( <i>Class</i>, <i>LibID</i>, <i>AppID</i> )</li>
78
<li><div class="fn"/><b><a href="qaxfactory.html#QAXTYPE">QAXTYPE</a></b> ( <i>Class</i> )</li>
80
<h3>Additional Inherited Members</h3>
82
<li><div class="fn"/>1 property inherited from <a href="qobject.html#properties">QObject</a></li>
83
<li><div class="fn"/>1 public slot inherited from <a href="qobject.html#public-slots">QObject</a></li>
84
<li><div class="fn"/>1 signal inherited from <a href="qobject.html#signals">QObject</a></li>
85
<li><div class="fn"/>7 protected functions inherited from <a href="qobject.html#protected-functions">QObject</a></li>
87
<a name="details"></a>
89
<h2>Detailed Description</h2>
90
<p>The QAxFactory class defines a factory for the creation of COM components.</p>
91
<p>Implement this factory once in your COM server to provide information about the components the server can create. Subclass QAxFactory and implement the pure virtual functions in any implementation file (e.g. main.cpp), and export the factory using the <tt>QAXFACTORY_EXPORT()</tt> macro.</p>
92
<pre> QStringList ActiveQtFactory::featureList() const
95
list << "ActiveX1";
96
list << "ActiveX2";
100
QObject *ActiveQtFactory::createObject(const QString &key)
102
if (key == "ActiveX1")
103
return new ActiveX1(parent);
104
if (key == "ActiveX2")
105
return new ActiveX2(parent);
109
const QMetaObject *ActiveQtFactory::metaObject(const QString &key) const
111
if (key == "ActiveX1")
112
return &ActiveX1::staticMetaObject;
113
if (key == "ActiveX2")
114
return &ActiveX2::staticMetaObject;
117
QUuid ActiveQtFactory::classID(const QString &key) const
119
if (key == "ActiveX1")
120
return "{01234567-89AB-CDEF-0123-456789ABCDEF}";
125
QUuid ActiveQtFactory::interfaceID(const QString &key) const
127
if (key == "ActiveX1")
128
return "{01234567-89AB-CDEF-0123-456789ABCDEF}";
133
QUuid ActiveQtFactory::eventsID(const QString &key) const
135
if (key == "ActiveX1")
136
return "{01234567-89AB-CDEF-0123-456789ABCDEF}";
142
ActiveQtFactory, // factory class
143
"{01234567-89AB-CDEF-0123-456789ABCDEF}", // type library ID
144
"{01234567-89AB-CDEF-0123-456789ABCDEF}" // application ID
146
<p>If you use the <tt>Q_CLASSINFO()</tt> macro to provide the unique identifiers or other attributes for your class you can use the <tt>QAXFACTORY_BEGIN()</tt>, <tt>QAXCLASS()</tt> and <tt>QAXFACTORY_END()</tt> macros to expose one or more classes as COM objects.</p>
147
<pre> QAXFACTORY_BEGIN(
148
"{01234567-89AB-CDEF-0123-456789ABCDEF}", // type library ID
149
"{01234567-89AB-CDEF-0123-456789ABCDEF}" // application ID
153
QAXFACTORY_END()</pre>
154
<p>If your server supports just a single COM object, you can use a default factory implementation through the <tt>QAXFACTORY_DEFAULT()</tt> macro.</p>
155
<pre> #include <qapplication.h>
156
#include <qaxfactory.h>
158
#include "theactivex.h"
161
TheActiveX, // widget class
162
"{01234567-89AB-CDEF-0123-456789ABCDEF}", // class ID
163
"{01234567-89AB-CDEF-0123-456789ABCDEF}", // interface ID
164
"{01234567-89AB-CDEF-0123-456789ABCDEF}", // event interface ID
165
"{01234567-89AB-CDEF-0123-456789ABCDEF}", // type library ID
166
"{01234567-89AB-CDEF-0123-456789ABCDEF}" // application ID
168
<p>Only one QAxFactory implementation may be instantiated and exported by an ActiveX server application. This instance is accessible through the global qAxFactory() function.</p>
169
<p>A factory can also reimplement the <a href="qaxfactory.html#registerClass">registerClass</a>() and <a href="qaxfactory.html#unregisterClass">unregisterClass</a>() functions to set additional flags for an ActiveX control in the registry. To limit the number of methods or properties a widget class exposes from its parent classes reimplement <a href="qaxfactory.html#exposeToSuperClass">exposeToSuperClass</a>().</p>
170
<p>See also <a href="qaxaggregated.html">QAxAggregated</a>, <a href="qaxbindable.html">QAxBindable</a>, and <a href="activeqt.html">ActiveQt Framework</a>.</p>
172
<h2>Member Type Documentation</h2>
173
<h3 class="fn"><a name="ServerType-enum"></a>enum QAxFactory::ServerType</h3>
174
<p>This enum specifies the different types of servers that can be started with startServer.</p>
175
<table border="1" cellpadding="2" cellspacing="1" width="100%">
176
<tr><th width="25%">Constant</th><th width="15%">Value</th><th width="60%">Description</th></tr>
177
<tr><td valign="top"><tt>QAxFactory::SingleInstance</tt></td><td align="center" valign="top"><tt>0</tt></td><td valign="top">The server can create only one instance of each supplied class.</td></tr>
178
<tr><td valign="top"><tt>QAxFactory::MultipleInstances</tt></td><td align="center" valign="top"><tt>1</tt></td><td valign="top">The server can create multiple instances of each supplied class.</td></tr>
181
<h2>Member Function Documentation</h2>
182
<h3 class="fn"><a name="QAxFactory"></a>QAxFactory::QAxFactory ( const <a href="quuid.html">QUuid</a> & <i>libid</i>, const <a href="quuid.html">QUuid</a> & <i>appid</i> )</h3>
183
<p>Constructs a <a href="qaxfactory.html">QAxFactory</a> object that returns <i>libid</i> and <i>appid</i> in the implementation of the respective interface functions.</p>
184
<h3 class="fn"><a name="dtor.QAxFactory"></a>QAxFactory::~QAxFactory () <tt> [virtual]</tt></h3>
185
<p>Destroys the <a href="qaxfactory.html">QAxFactory</a> object.</p>
186
<h3 class="fn"><a name="appID"></a><a href="quuid.html">QUuid</a> QAxFactory::appID () const <tt> [virtual]</tt></h3>
187
<p>Reimplement this function to return the ActiveX server's application identifier.</p>
188
<h3 class="fn"><a name="classID"></a><a href="quuid.html">QUuid</a> QAxFactory::classID ( const <a href="qstring.html">QString</a> & <i>key</i> ) const <tt> [virtual]</tt></h3>
189
<p>Reimplement this function to return the class identifier for each <i>key</i> returned by the <a href="qaxfactory.html#featureList">featureList</a>() implementation, or an empty <a href="quuid.html">QUuid</a> if this factory doesn't support the value of <i>key</i>.</p>
190
<p>The default implementation interprets <i>key</i> as the class name, and returns the value of the <a href="qobject.html#Q_CLASSINFO">Q_CLASSINFO</a>() entry "ClassID".</p>
191
<h3 class="fn"><a name="createObject"></a><a href="qobject.html">QObject</a> * QAxFactory::createObject ( const <a href="qstring.html">QString</a> & <i>key</i> ) <tt> [pure virtual]</tt></h3>
192
<p>Reimplement this function to return a new object for <i>key</i>, or 0 if this factory doesn't support the value of <i>key</i>.</p>
193
<p>If the object returned is a <a href="qwidget.html">QWidget</a> it will be exposed as an ActiveX control, otherwise the returned object will be exposed as a simple COM object.</p>
194
<h3 class="fn"><a name="createObjectWrapper"></a>bool QAxFactory::createObjectWrapper ( <a href="qobject.html">QObject</a> * <i>object</i>, IDispatch ** <i>wrapper</i> ) <tt> [virtual]</tt></h3>
195
<p>Reimplement this function to provide the COM object for <i>object</i> in <i>wrapper</i>. Return true if the function was successfull, otherwise return false.</p>
196
<p>The default implementation creates a generic automation wrapper based on the meta object information of <i>object</i>.</p>
197
<h3 class="fn"><a name="eventsID"></a><a href="quuid.html">QUuid</a> QAxFactory::eventsID ( const <a href="qstring.html">QString</a> & <i>key</i> ) const <tt> [virtual]</tt></h3>
198
<p>Reimplement this function to return the identifier of the event interface for each <i>key</i> returned by the <a href="qaxfactory.html#featureList">featureList</a>() implementation, or an empty <a href="quuid.html">QUuid</a> if this factory doesn't support the value of <i>key</i>.</p>
199
<p>The default implementation interprets <i>key</i> as the class name, and returns the value of the <a href="qobject.html#Q_CLASSINFO">Q_CLASSINFO</a>() entry "EventsID".</p>
200
<h3 class="fn"><a name="exposeToSuperClass"></a><a href="qstring.html">QString</a> QAxFactory::exposeToSuperClass ( const <a href="qstring.html">QString</a> & <i>key</i> ) const <tt> [virtual]</tt></h3>
201
<p>Reimplement this function to return the name of the super class of <i>key</i> up to which methods and properties should be exposed by the ActiveX control.</p>
202
<p>The default implementation interprets <i>key</i> as the class name, and returns the value of the <tt>Q_CLASSINFO()</tt> entry "ToSuperClass". If no such value is set the null-string is returned, and the functions and properties of all the super classes including <a href="qwidget.html">QWidget</a> will be exposed.</p>
203
<p>To only expose the functions and properties of the class itself, reimplement this function to return <i>key</i>.</p>
204
<h3 class="fn"><a name="featureList"></a><a href="qstringlist.html">QStringList</a> QAxFactory::featureList () const <tt> [pure virtual]</tt></h3>
205
<p>Reimplement this function to return a list of the widgets (class names) supported by this factory.</p>
206
<h3 class="fn"><a name="hasStockEvents"></a>bool QAxFactory::hasStockEvents ( const <a href="qstring.html">QString</a> & <i>key</i> ) const <tt> [virtual]</tt></h3>
207
<p>Reimplement this function to return true if the ActiveX control <i>key</i> should support the standard ActiveX events</p>
218
<p>The default implementation interprets <i>key</i> as the class name, and returns true if the value of the <tt>Q_CLASSINFO()</tt> entry "StockEvents" is "yes". Otherwise this function returns false.</p>
219
<h3 class="fn"><a name="interfaceID"></a><a href="quuid.html">QUuid</a> QAxFactory::interfaceID ( const <a href="qstring.html">QString</a> & <i>key</i> ) const <tt> [virtual]</tt></h3>
220
<p>Reimplement this function to return the interface identifier for each <i>key</i> returned by the <a href="qaxfactory.html#featureList">featureList</a>() implementation, or an empty <a href="quuid.html">QUuid</a> if this factory doesn't support the value of <i>key</i>.</p>
221
<p>The default implementation interprets <i>key</i> as the class name, and returns the value of the <a href="qobject.html#Q_CLASSINFO">Q_CLASSINFO</a>() entry "InterfaceID".</p>
222
<h3 class="fn"><a name="isServer"></a>bool QAxFactory::isServer () <tt> [static]</tt></h3>
223
<p>Returns true if the application has been started (by COM) as an ActiveX server, otherwise returns false.</p>
224
<pre> int main(int argc, char *argv[])
226
QApplication app(argc, argv);
227
if (!QAxFactory::isServer()) {
228
// initialize for stand-alone execution
232
<h3 class="fn"><a name="isService"></a>bool QAxFactory::isService () const <tt> [virtual]</tt></h3>
233
<p>Reimplement this function to return true if the server is running as a persistent service (e.g. an NT service) and should not terminate even when all objects provided have been released.</p>
234
<p>The default implementation returns false.</p>
235
<h3 class="fn"><a name="metaObject"></a>const <a href="qmetaobject.html">QMetaObject</a> * QAxFactory::metaObject ( const <a href="qstring.html">QString</a> & <i>key</i> ) const <tt> [pure virtual]</tt></h3>
236
<p>Reimplement this function to return the <a href="qmetaobject.html">QMetaObject</a> corresponding to <i>key</i>, or 0 if this factory doesn't support the value of <i>key</i>.</p>
237
<h3 class="fn"><a name="registerActiveObject"></a>bool QAxFactory::registerActiveObject ( <a href="qobject.html">QObject</a> * <i>object</i> ) <tt> [static]</tt></h3>
238
<p>Registers the <a href="qobject.html">QObject</a> <i>object</i> with COM as a running object, and returns true if the registration succeeded, otherwise returns false. The object is unregistered automatically when it is destroyed.</p>
239
<p>This function should only be called if the application has been started by the user (i.e. not by COM to respond to a request), and only for one object, usually the toplevel object of the application's object hierarchy.</p>
240
<p>This function does nothing and returns false if the object's class info for "RegisterObject" is not set to "yes", or if the server is an in-process server.</p>
241
<h3 class="fn"><a name="registerClass"></a>void QAxFactory::registerClass ( const <a href="qstring.html">QString</a> & <i>key</i>, <a href="qsettings.html">QSettings</a> * <i>settings</i> ) const <tt> [virtual]</tt></h3>
242
<p>Registers additional values for the class <i>key</i> in the system registry using the <i>settings</i> object. The standard values have already been registed by the framework, but additional values, e.g. implemented categories, can be added in an implementation of this function.</p>
243
<pre> settings->setValue("/CLSID/" + classID(key)
244
+ "/Implemented Categories/"
245
+ "/{00000000-0000-0000-000000000000}/.",
247
<p>If you reimplement this function you must also reimplement <a href="qaxfactory.html#unregisterClass">unregisterClass</a>() to remove the additional registry values.</p>
248
<p>See also <a href="qsettings.html">QSettings</a>.</p>
249
<h3 class="fn"><a name="serverDirPath"></a><a href="qstring.html">QString</a> QAxFactory::serverDirPath () <tt> [static]</tt></h3>
250
<p>Returns the directory that contains the server binary.</p>
251
<p>For out-of-process servers this is the same as <a href="qcoreapplication.html#applicationDirPath">QApplication::applicationDirPath</a>(). For in-process servers that function returns the directory that contains the hosting application.</p>
252
<h3 class="fn"><a name="serverFilePath"></a><a href="qstring.html">QString</a> QAxFactory::serverFilePath () <tt> [static]</tt></h3>
253
<p>Returns the file path of the server binary.</p>
254
<p>For out-of-process servers this is the same as <a href="qcoreapplication.html#applicationFilePath">QApplication::applicationFilePath</a>(). For in-process servers that function returns the file path of the hosting application.</p>
255
<h3 class="fn"><a name="startServer"></a>bool QAxFactory::startServer ( <a href="qaxfactory.html#ServerType-enum">ServerType</a> <i>type</i> = MultipleInstances ) <tt> [static]</tt></h3>
256
<p>Starts the COM server with <i>type</i> and returns true if successful, otherwise returns false.</p>
257
<p>Calling this function if the server is already running (or for an in-process server) does nothing and returns true.</p>
258
<p>The server is started automatically with <i>type</i> set to MultipleUse if the server executable has been started with the <tt>-activex</tt> command line parameter.</p>
259
<h3 class="fn"><a name="stayTopLevel"></a>bool QAxFactory::stayTopLevel ( const <a href="qstring.html">QString</a> & <i>key</i> ) const <tt> [virtual]</tt></h3>
260
<p>Reimplement this function to return true if the ActiveX control <i>key</i> should be a top level window, e.g. a dialog. The default implementation returns false.</p>
261
<h3 class="fn"><a name="stopServer"></a>bool QAxFactory::stopServer () <tt> [static]</tt></h3>
262
<p>Stops the COM server and returns true if successful, otherwise returns false.</p>
263
<p>Calling this function if the server is not running (or for an in-process server) does nothing and returns true.</p>
264
<p>Stopping the server will not invalidate existing objects, but no new objects can be created from the existing server process. Usually COM will start a new server process if additional objects are requested.</p>
265
<p>The server is stopped automatically when the main() function returns.</p>
266
<h3 class="fn"><a name="typeLibID"></a><a href="quuid.html">QUuid</a> QAxFactory::typeLibID () const <tt> [virtual]</tt></h3>
267
<p>Reimplement this function to return the ActiveX server's type library identifier.</p>
268
<h3 class="fn"><a name="unregisterClass"></a>void QAxFactory::unregisterClass ( const <a href="qstring.html">QString</a> & <i>key</i>, <a href="qsettings.html">QSettings</a> * <i>settings</i> ) const <tt> [virtual]</tt></h3>
269
<p>Unregisters any additional values for the class <i>key</i> from the system registry using the <i>settings</i> object.</p>
270
<pre> settings->remove("/CLSID/" + classID(key)
271
+ "/Implemented Categories"
272
+ "/{00000000-0000-0000-000000000000}/.");</pre>
273
<p>See also <a href="qaxfactory.html#registerClass">registerClass</a>() and <a href="qsettings.html">QSettings</a>.</p>
274
<h3 class="fn"><a name="validateLicenseKey"></a>bool QAxFactory::validateLicenseKey ( const <a href="qstring.html">QString</a> & <i>key</i>, const <a href="qstring.html">QString</a> & <i>licenseKey</i> ) const <tt> [virtual]</tt></h3>
275
<p>Reimplement this function to return true if <i>licenseKey</i> is a valid license for the class <i>key</i>, or if the current machine is licensed.</p>
276
<p>The default implementation returns true if the class <i>key</i> is not licensed (ie. no <tt>Q_CLASSINFO()</tt> attribute "LicenseKey"), or if <i>licenseKey</i> matches the value of the "LicenseKey" attribute, or if the machine is licensed through a .LIC file with the same filename as this COM server.</p>
278
<h2>Macro Documentation</h2>
279
<h3 class="fn"><a name="QAXCLASS"></a>QAXCLASS ( <i>Class</i> )</h3>
280
<p>This macro adds a creatable COM class <i>Class</i> to the <a href="qaxfactory.html">QAxFactory</a> declared with the <a href="qaxfactory.html#QAXFACTORY_BEGIN">QAXFACTORY_BEGIN</a>() macro.</p>
281
<p>See also <a href="qaxfactory.html#QAXFACTORY_BEGIN">QAXFACTORY_BEGIN</a>(), <a href="qaxfactory.html#QAXTYPE">QAXTYPE</a>(), <a href="qaxfactory.html#QAXFACTORY_END">QAXFACTORY_END</a>(), and <a href="qobject.html#Q_CLASSINFO">Q_CLASSINFO</a>().</p>
282
<h3 class="fn"><a name="QAXFACTORY_BEGIN"></a>QAXFACTORY_BEGIN ( <i>IDTypeLib</i>, <i>IDApp</i> )</h3>
283
<p>This macro can be used to export multiple <a href="qobject.html">QObject</a> classes through an implicitly declared <a href="qaxfactory.html">QAxFactory</a> implementation. All <a href="qobject.html">QObject</a> classes have to declare the ClassID, InterfaceID and EventsID (if applicable) through the <a href="qobject.html#Q_CLASSINFO">Q_CLASSINFO</a>() macro. All declarations will be in a type library with the id <i>LibID</i>, and if the server is an executable server then it will have the application id <i>AppID</i>.</p>
284
<p>This macro needs to be used together with the <a href="qaxfactory.html#QAXCLASS">QAXCLASS</a>(), <a href="qaxfactory.html#QAXTYPE">QAXTYPE</a>() and <a href="qaxfactory.html#QAXFACTORY_END">QAXFACTORY_END</a>() macros.</p>
285
<pre> QAXFACTORY_BEGIN(
286
"{01234567-89AB-CDEF-0123-456789ABCDEF}", // type library ID
287
"{01234567-89AB-CDEF-0123-456789ABCDEF}" // application ID
291
QAXFACTORY_END()</pre>
292
<h3 class="fn"><a name="QAXFACTORY_DEFAULT"></a>QAXFACTORY_DEFAULT ( <i>Class</i>, <i>ClassID</i>, <i>InterfaceID</i>, <i>EventID</i>, <i>LibID</i>, <i>AppID</i> )</h3>
293
<p>This macro can be used to export a single <a href="qobject.html">QObject</a> subclass <i>Class</i> a this COM server through an implicitly declared <a href="qaxfactory.html">QAxFactory</a> implementation.</p>
294
<p>This macro exports the class <i>Class</i> as a COM coclass with the CLSID <i>ClassID</i>. The properties and slots will be declared through a COM interface with the IID <i>InterfaceID</i>, and signals will be declared through a COM event interface with the IID <i>EventID</i>. All declarations will be in a type library with the id <i>LibID</i>, and if the server is an executable server then it will have the application id <i>AppID</i>.</p>
295
<pre> #include <qaxfactory.h>
297
#include "theactivex.h"
300
TheActiveX, // widget class
301
"{01234567-89AB-CDEF-0123-456789ABCDEF}", // class ID
302
"{01234567-89AB-CDEF-0123-456789ABCDEF}", // interface ID
303
"{01234567-89AB-CDEF-0123-456789ABCDEF}", // event interface ID
304
"{01234567-89AB-CDEF-0123-456789ABCDEF}", // type library ID
305
"{01234567-89AB-CDEF-0123-456789ABCDEF}" // application ID
307
<p>See also <a href="qaxfactory.html#QAXFACTORY_EXPORT">QAXFACTORY_EXPORT</a>() and <a href="qaxfactory.html#QAXFACTORY_BEGIN">QAXFACTORY_BEGIN</a>().</p>
308
<h3 class="fn"><a name="QAXFACTORY_END"></a>QAXFACTORY_END ()</h3>
309
<p>Completes the <a href="qaxfactory.html">QAxFactory</a> declaration started with the <a href="qaxfactory.html#QAXFACTORY_BEGIN">QAXFACTORY_BEGIN</a>() macro.</p>
310
<p>See also <a href="qaxfactory.html#QAXFACTORY_BEGIN">QAXFACTORY_BEGIN</a>(), <a href="qaxfactory.html#QAXCLASS">QAXCLASS</a>(), and <a href="qaxfactory.html#QAXTYPE">QAXTYPE</a>().</p>
311
<h3 class="fn"><a name="QAXFACTORY_EXPORT"></a>QAXFACTORY_EXPORT ( <i>Class</i>, <i>LibID</i>, <i>AppID</i> )</h3>
312
<p>This macro can be used to export a <a href="qaxfactory.html">QAxFactory</a> implementation <i>Class</i> from a COM server. All declarations will be in a type library with the id <i>LibID</i>, and if the server is an executable server then it will have the application id <i>AppID</i>.</p>
313
<pre> QAXFACTORY_EXPORT(
314
MyFactory, // factory class
315
"{01234567-89AB-CDEF-0123-456789ABCDEF}", // type library ID
316
"{01234567-89AB-CDEF-0123-456789ABCDEF}" // application ID
318
<p>See also <a href="qaxfactory.html#QAXFACTORY_BEGIN">QAXFACTORY_BEGIN</a>().</p>
319
<h3 class="fn"><a name="QAXTYPE"></a>QAXTYPE ( <i>Class</i> )</h3>
320
<p>This macro adds a non-creatable COM class <i>Class</i> to the <a href="qaxfactory.html">QAxFactory</a> declared with the <a href="qaxfactory.html#QAXFACTORY_BEGIN">QAXFACTORY_BEGIN</a>(). The class <i>Class</i> can be used in APIs of other COM classes exported through QAXTYPE() or <a href="qaxfactory.html#QAXCLASS">QAXCLASS</a>().</p>
321
<p>Instances of type <i>Class</i> can only be retrieved using APIs of already instantiated objects.</p>
322
<p>See also <a href="qaxfactory.html#QAXFACTORY_BEGIN">QAXFACTORY_BEGIN</a>(), <a href="qaxfactory.html#QAXCLASS">QAXCLASS</a>(), <a href="qaxfactory.html#QAXFACTORY_END">QAXFACTORY_END</a>(), and <a href="qobject.html#Q_CLASSINFO">Q_CLASSINFO</a>().</p>
323
<p /><address><hr /><div align="center">
324
<table width="100%" cellspacing="0" border="0"><tr class="address">
325
<td width="30%">Copyright © 2005 <a href="trolltech.html">Trolltech</a></td>
326
<td width="40%" align="center"><a href="trademarks.html">Trademarks</a></td>
327
<td width="30%" align="right"><div align="right">Qt 4.0.0</div></td>
328
</tr></table></div></address></body>