~oif-team/ubuntu/natty/qt4-x11/xi2.1

« back to all changes in this revision

Viewing changes to doc/html/qaxfactory.html

  • Committer: Bazaar Package Importer
  • Author(s): Adam Conrad
  • Date: 2005-08-24 04:09:09 UTC
  • Revision ID: james.westby@ubuntu.com-20050824040909-xmxe9jfr4a0w5671
Tags: upstream-4.0.0
ImportĀ upstreamĀ versionĀ 4.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?xml version="1.0" encoding="iso-8859-1"?>
 
2
<!DOCTYPE html
 
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 -->
 
6
<head>
 
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>
 
14
</head>
 
15
<body>
 
16
<table border="0" cellpadding="0" cellspacing="0" width="100%">
 
17
<tr>
 
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">&nbsp;&nbsp;</td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a>&nbsp;&middot; <a href="classes.html"><font color="#004faf">All&nbsp;Classes</font></a>&nbsp;&middot; <a href="mainclasses.html"><font color="#004faf">Main&nbsp;Classes</font></a>&nbsp;&middot; <a href="annotated.html"><font color="#004faf">Annotated</font></a>&nbsp;&middot; <a href="groups.html"><font color="#004faf">Grouped&nbsp;Classes</font></a>&nbsp;&middot; <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 &lt;QAxFactory&gt;</pre><p>Part of the <a href="qaxserver.html">QAxServer</a> module.</p>
 
23
<p>Inherits <a href="qobject.html">QObject</a>.</p>
 
24
<ul>
 
25
<li><a href="qaxfactory-members.html">List of all members, including inherited members</a></li>
 
26
</ul>
 
27
<a name="public-types"></a>
 
28
<h3>Public Types</h3>
 
29
<ul>
 
30
<li><div class="fn"/>enum <b><a href="qaxfactory.html#ServerType-enum">ServerType</a></b> { SingleInstance, MultipleInstances }</li>
 
31
</ul>
 
32
<a name="public-functions"></a>
 
33
<h3>Public Functions</h3>
 
34
<ul>
 
35
<li><div class="fn"/><b><a href="qaxfactory.html#QAxFactory">QAxFactory</a></b> ( const QUuid &amp; <i>libid</i>, const QUuid &amp; <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 &amp; <i>key</i> ) const</li>
 
39
<li><div class="fn"/>virtual QObject * <b><a href="qaxfactory.html#createObject">createObject</a></b> ( const QString &amp; <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 &amp; <i>key</i> ) const</li>
 
42
<li><div class="fn"/>virtual QString <b><a href="qaxfactory.html#exposeToSuperClass">exposeToSuperClass</a></b> ( const QString &amp; <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 &amp; <i>key</i> ) const</li>
 
45
<li><div class="fn"/>virtual QUuid <b><a href="qaxfactory.html#interfaceID">interfaceID</a></b> ( const QString &amp; <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 &amp; <i>key</i> ) const = 0</li>
 
48
<li><div class="fn"/>virtual void <b><a href="qaxfactory.html#registerClass">registerClass</a></b> ( const QString &amp; <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 &amp; <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 &amp; <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 &amp; <i>key</i>, const QString &amp; <i>licenseKey</i> ) const</li>
 
53
</ul>
 
54
<ul>
 
55
<li><div class="fn"/>28 public functions inherited from <a href="qobject.html#public-functions">QObject</a></li>
 
56
</ul>
 
57
<a name="static-public-members"></a>
 
58
<h3>Static Public Members</h3>
 
59
<ul>
 
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>
 
66
</ul>
 
67
<ul>
 
68
<li><div class="fn"/>4 static public members inherited from <a href="qobject.html#static-public-members">QObject</a></li>
 
69
</ul>
 
70
<a name="macros"></a>
 
71
<h3>Macros</h3>
 
72
<ul>
 
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>
 
79
</ul>
 
80
<h3>Additional Inherited Members</h3>
 
81
<ul>
 
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>
 
86
</ul>
 
87
<a name="details"></a>
 
88
<hr />
 
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>&nbsp;   QStringList ActiveQtFactory::featureList() const
 
93
    {
 
94
        QStringList list;
 
95
        list &lt;&lt; &quot;ActiveX1&quot;;
 
96
        list &lt;&lt; &quot;ActiveX2&quot;;
 
97
        return list;
 
98
    }
 
99
 
 
100
    QObject *ActiveQtFactory::createObject(const QString &amp;key)
 
101
    {
 
102
        if (key == &quot;ActiveX1&quot;)
 
103
            return new ActiveX1(parent);
 
104
        if (key == &quot;ActiveX2&quot;)
 
105
            return new ActiveX2(parent);
 
106
        return 0;
 
107
    }
 
108
 
 
109
    const QMetaObject *ActiveQtFactory::metaObject(const QString &amp;key) const
 
110
    {
 
111
        if (key == &quot;ActiveX1&quot;)
 
112
            return &amp;ActiveX1::staticMetaObject;
 
113
        if (key == &quot;ActiveX2&quot;)
 
114
            return &amp;ActiveX2::staticMetaObject;
 
115
    }
 
116
 
 
117
    QUuid ActiveQtFactory::classID(const QString &amp;key) const
 
118
    {
 
119
        if (key == &quot;ActiveX1&quot;)
 
120
            return &quot;{01234567-89AB-CDEF-0123-456789ABCDEF}&quot;;
 
121
        ...
 
122
        return QUuid();
 
123
    }
 
124
 
 
125
    QUuid ActiveQtFactory::interfaceID(const QString &amp;key) const
 
126
    {
 
127
        if (key == &quot;ActiveX1&quot;)
 
128
            return &quot;{01234567-89AB-CDEF-0123-456789ABCDEF}&quot;;
 
129
        ...
 
130
        return QUuid();
 
131
    }
 
132
 
 
133
    QUuid ActiveQtFactory::eventsID(const QString &amp;key) const
 
134
    {
 
135
        if (key == &quot;ActiveX1&quot;)
 
136
            return &quot;{01234567-89AB-CDEF-0123-456789ABCDEF}&quot;;
 
137
        ...
 
138
        return QUuid();
 
139
    }
 
140
 
 
141
    QAXFACTORY_EXPORT(
 
142
        ActiveQtFactory,                          // factory class
 
143
        &quot;{01234567-89AB-CDEF-0123-456789ABCDEF}&quot;, // type library ID
 
144
        &quot;{01234567-89AB-CDEF-0123-456789ABCDEF}&quot;  // application ID
 
145
    )</pre>
 
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>&nbsp;   QAXFACTORY_BEGIN(
 
148
        &quot;{01234567-89AB-CDEF-0123-456789ABCDEF}&quot;, // type library ID
 
149
        &quot;{01234567-89AB-CDEF-0123-456789ABCDEF}&quot;  // application ID
 
150
    )
 
151
        QAXCLASS(Class1)
 
152
        QAXCLASS(Class2)
 
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>&nbsp;   #include &lt;qapplication.h&gt;
 
156
    #include &lt;qaxfactory.h&gt;
 
157
 
 
158
    #include &quot;theactivex.h&quot;
 
159
 
 
160
    QAXFACTORY_DEFAULT(
 
161
        TheActiveX,                           // widget class
 
162
        &quot;{01234567-89AB-CDEF-0123-456789ABCDEF}&quot;, // class ID
 
163
        &quot;{01234567-89AB-CDEF-0123-456789ABCDEF}&quot;, // interface ID
 
164
        &quot;{01234567-89AB-CDEF-0123-456789ABCDEF}&quot;, // event interface ID
 
165
        &quot;{01234567-89AB-CDEF-0123-456789ABCDEF}&quot;, // type library ID
 
166
        &quot;{01234567-89AB-CDEF-0123-456789ABCDEF}&quot;  // application ID
 
167
    )</pre>
 
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>
 
171
<hr />
 
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>
 
179
</table>
 
180
<hr />
 
181
<h2>Member Function Documentation</h2>
 
182
<h3 class="fn"><a name="QAxFactory"></a>QAxFactory::QAxFactory ( const <a href="quuid.html">QUuid</a> &amp; <i>libid</i>, const <a href="quuid.html">QUuid</a> &amp; <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 ()&nbsp;&nbsp;<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&nbsp;&nbsp;<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> &amp; <i>key</i> ) const&nbsp;&nbsp;<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 &quot;ClassID&quot;.</p>
 
191
<h3 class="fn"><a name="createObject"></a><a href="qobject.html">QObject</a> * QAxFactory::createObject ( const <a href="qstring.html">QString</a> &amp; <i>key</i> )&nbsp;&nbsp;<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> )&nbsp;&nbsp;<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> &amp; <i>key</i> ) const&nbsp;&nbsp;<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 &quot;EventsID&quot;.</p>
 
200
<h3 class="fn"><a name="exposeToSuperClass"></a><a href="qstring.html">QString</a> QAxFactory::exposeToSuperClass ( const <a href="qstring.html">QString</a> &amp; <i>key</i> ) const&nbsp;&nbsp;<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 &quot;ToSuperClass&quot;. 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&nbsp;&nbsp;<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> &amp; <i>key</i> ) const&nbsp;&nbsp;<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>
 
208
<ul>
 
209
<li>Click</li>
 
210
<li>DblClick</li>
 
211
<li>KeyDown</li>
 
212
<li>KeyPress</li>
 
213
<li>KeyUp</li>
 
214
<li>MouseDown</li>
 
215
<li>MouseUp</li>
 
216
<li>MouseMove</li>
 
217
</ul>
 
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 &quot;StockEvents&quot; is &quot;yes&quot;. 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> &amp; <i>key</i> ) const&nbsp;&nbsp;<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 &quot;InterfaceID&quot;.</p>
 
222
<h3 class="fn"><a name="isServer"></a>bool QAxFactory::isServer ()&nbsp;&nbsp;<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>&nbsp;   int main(int argc, char *argv[])
 
225
    {
 
226
        QApplication app(argc, argv);
 
227
        if (!QAxFactory::isServer()) {
 
228
            // initialize for stand-alone execution
 
229
        }
 
230
        return app.exec();
 
231
    }</pre>
 
232
<h3 class="fn"><a name="isService"></a>bool QAxFactory::isService () const&nbsp;&nbsp;<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> &amp; <i>key</i> ) const&nbsp;&nbsp;<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> )&nbsp;&nbsp;<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 &quot;RegisterObject&quot; is not set to &quot;yes&quot;, 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> &amp; <i>key</i>, <a href="qsettings.html">QSettings</a> * <i>settings</i> ) const&nbsp;&nbsp;<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>&nbsp;   settings-&gt;setValue(&quot;/CLSID/&quot; + classID(key)
 
244
                       + &quot;/Implemented Categories/&quot;
 
245
                       + &quot;/{00000000-0000-0000-000000000000}/.&quot;,
 
246
                       QString());</pre>
 
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 ()&nbsp;&nbsp;<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 ()&nbsp;&nbsp;<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 )&nbsp;&nbsp;<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> &amp; <i>key</i> ) const&nbsp;&nbsp;<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 ()&nbsp;&nbsp;<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&nbsp;&nbsp;<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> &amp; <i>key</i>, <a href="qsettings.html">QSettings</a> * <i>settings</i> ) const&nbsp;&nbsp;<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>&nbsp;   settings-&gt;remove(&quot;/CLSID/&quot; + classID(key)
 
271
                     + &quot;/Implemented Categories&quot;
 
272
                     + &quot;/{00000000-0000-0000-000000000000}/.&quot;);</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> &amp; <i>key</i>, const <a href="qstring.html">QString</a> &amp; <i>licenseKey</i> ) const&nbsp;&nbsp;<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 &quot;LicenseKey&quot;), or if <i>licenseKey</i> matches the value of the &quot;LicenseKey&quot; attribute, or if the machine is licensed through a .LIC file with the same filename as this COM server.</p>
 
277
<hr />
 
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>&nbsp;   QAXFACTORY_BEGIN(
 
286
        &quot;{01234567-89AB-CDEF-0123-456789ABCDEF}&quot;, // type library ID
 
287
        &quot;{01234567-89AB-CDEF-0123-456789ABCDEF}&quot;  // application ID
 
288
    )
 
289
        QAXCLASS(Class1)
 
290
        QAXCLASS(Class2)
 
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>&nbsp;   #include &lt;qaxfactory.h&gt;
 
296
 
 
297
    #include &quot;theactivex.h&quot;
 
298
 
 
299
    QAXFACTORY_DEFAULT(
 
300
        TheActiveX,                           // widget class
 
301
        &quot;{01234567-89AB-CDEF-0123-456789ABCDEF}&quot;, // class ID
 
302
        &quot;{01234567-89AB-CDEF-0123-456789ABCDEF}&quot;, // interface ID
 
303
        &quot;{01234567-89AB-CDEF-0123-456789ABCDEF}&quot;, // event interface ID
 
304
        &quot;{01234567-89AB-CDEF-0123-456789ABCDEF}&quot;, // type library ID
 
305
        &quot;{01234567-89AB-CDEF-0123-456789ABCDEF}&quot;  // application ID
 
306
    )</pre>
 
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>&nbsp;   QAXFACTORY_EXPORT(
 
314
        MyFactory,                                // factory class
 
315
        &quot;{01234567-89AB-CDEF-0123-456789ABCDEF}&quot;, // type library ID
 
316
        &quot;{01234567-89AB-CDEF-0123-456789ABCDEF}&quot;  // application ID
 
317
    )</pre>
 
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 &copy; 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>
 
329
</html>