summaryrefslogtreecommitdiffstats
path: root/doc/html/qaxbase.html
blob: 95ef8ba92efe20ba7a8e70434b3d223082d5e737 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- /home/espenr/tmp/qt-3.3.8-espenr-2499/qt-x11-free-3.3.8/extensions/activeqt/container/qaxbase.cpp:556 -->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>QAxBase Class</title>
<style type="text/css"><!--
fn { margin-left: 1cm; text-indent: -1cm; }
a:link { color: #004faf; text-decoration: none }
a:visited { color: #672967; text-decoration: none }
body { background: #ffffff; color: black; }
--></style>
</head>
<body>

<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr bgcolor="#E5E5E5">
<td valign=center>
 <a href="index.html">
<font color="#004faf">Home</font></a>
 | <a href="classes.html">
<font color="#004faf">All&nbsp;Classes</font></a>
 | <a href="mainclasses.html">
<font color="#004faf">Main&nbsp;Classes</font></a>
 | <a href="annotated.html">
<font color="#004faf">Annotated</font></a>
 | <a href="groups.html">
<font color="#004faf">Grouped&nbsp;Classes</font></a>
 | <a href="functions.html">
<font color="#004faf">Functions</font></a>
</td>
<td align="right" valign="center"><img src="logo32.png" align="right" width="64" height="32" border="0"></td></tr></table><h1 align=center>QAxBase Class Reference<br><small>[<a href="qaxcontainer.html">QAxContainer module</a>]</small></h1>

<p>The QAxBase class is an abstract class that provides an API
to initalize and access a COM object.
<a href="#details">More...</a>
<p>This class is part of the <b>Qt ActiveQt Extension</b>.
<p><tt>#include &lt;<a href="qaxbase-h.html">qaxbase.h</a>&gt;</tt>
<p>Inherited by <a href="qaxobject.html">QAxObject</a> and <a href="qaxwidget.html">QAxWidget</a>.
<p><a href="qaxbase-members.html">List of all member functions.</a>
<h2>Public Members</h2>
<ul>
<li class=fn><a href="#QAxBase"><b>QAxBase</b></a> ( IUnknown&nbsp;*&nbsp;iface = 0 )</li>
<li class=fn>virtual <a href="#~QAxBase"><b>~QAxBase</b></a> ()</li>
<li class=fn>QString <a href="#control"><b>control</b></a> () const</li>
<li class=fn>long <a href="#queryInterface"><b>queryInterface</b></a> ( const&nbsp;QUuid&nbsp;&amp;&nbsp;uuid, void&nbsp;**&nbsp;iface ) const</li>
<li class=fn>QVariant <a href="#dynamicCall"><b>dynamicCall</b></a> ( const&nbsp;QCString&nbsp;&amp;&nbsp;function, const&nbsp;QVariant&nbsp;&amp;&nbsp;var1 = QVariant ( ), const&nbsp;QVariant&nbsp;&amp;&nbsp;var2 = QVariant ( ), const&nbsp;QVariant&nbsp;&amp;&nbsp;var3 = QVariant ( ), const&nbsp;QVariant&nbsp;&amp;&nbsp;var4 = QVariant ( ), const&nbsp;QVariant&nbsp;&amp;&nbsp;var5 = QVariant ( ), const&nbsp;QVariant&nbsp;&amp;&nbsp;var6 = QVariant ( ), const&nbsp;QVariant&nbsp;&amp;&nbsp;var7 = QVariant ( ), const&nbsp;QVariant&nbsp;&amp;&nbsp;var8 = QVariant ( ) )</li>
<li class=fn>QVariant <a href="#dynamicCall-2"><b>dynamicCall</b></a> ( const&nbsp;QCString&nbsp;&amp;&nbsp;function, QValueList&lt;QVariant&gt;&nbsp;&amp;&nbsp;vars )</li>
<li class=fn>QAxObject * <a href="#querySubObject"><b>querySubObject</b></a> ( const&nbsp;QCString&nbsp;&amp;&nbsp;name, const&nbsp;QVariant&nbsp;&amp;&nbsp;var1 = QVariant ( ), const&nbsp;QVariant&nbsp;&amp;&nbsp;var2 = QVariant ( ), const&nbsp;QVariant&nbsp;&amp;&nbsp;var3 = QVariant ( ), const&nbsp;QVariant&nbsp;&amp;&nbsp;var4 = QVariant ( ), const&nbsp;QVariant&nbsp;&amp;&nbsp;var5 = QVariant ( ), const&nbsp;QVariant&nbsp;&amp;&nbsp;var6 = QVariant ( ), const&nbsp;QVariant&nbsp;&amp;&nbsp;var7 = QVariant ( ), const&nbsp;QVariant&nbsp;&amp;&nbsp;var8 = QVariant ( ) )</li>
<li class=fn>PropertyBag <a href="#propertyBag"><b>propertyBag</b></a> () const</li>
<li class=fn>void <a href="#setPropertyBag"><b>setPropertyBag</b></a> ( const&nbsp;PropertyBag&nbsp;&amp;&nbsp;bag )</li>
<li class=fn>QString <a href="#generateDocumentation"><b>generateDocumentation</b></a> ()</li>
<li class=fn>virtual bool <a href="#propertyWritable"><b>propertyWritable</b></a> ( const&nbsp;char&nbsp;*&nbsp;prop ) const</li>
<li class=fn>virtual void <a href="#setPropertyWritable"><b>setPropertyWritable</b></a> ( const&nbsp;char&nbsp;*&nbsp;prop, bool&nbsp;ok )</li>
<li class=fn>bool <a href="#isNull"><b>isNull</b></a> () const</li>
<li class=fn>QVariant <a href="#asVariant"><b>asVariant</b></a> () const</li>
<li class=fn>enum <a href="#PropertyBag-enum"><b>PropertyBag</b></a> { }</li>
<li class=fn>virtual void <a href="#clear"><b>clear</b></a> ()</li>
<li class=fn>bool <a href="#setControl"><b>setControl</b></a> ( const QString &amp; )</li>
<li class=fn>void <a href="#disableMetaObject"><b>disableMetaObject</b></a> ()</li>
<li class=fn>void <a href="#disableClassInfo"><b>disableClassInfo</b></a> ()</li>
<li class=fn>void <a href="#disableEventSink"><b>disableEventSink</b></a> ()</li>
</ul>
<h2>Signals</h2>
<ul>
<li class=fn>void <a href="#signal"><b>signal</b></a> ( const&nbsp;QString&nbsp;&amp;&nbsp;name, int&nbsp;argc, void&nbsp;*&nbsp;argv )</li>
<li class=fn>void <a href="#propertyChanged"><b>propertyChanged</b></a> ( const&nbsp;QString&nbsp;&amp;&nbsp;name )</li>
<li class=fn>void <a href="#exception"><b>exception</b></a> ( int&nbsp;code, const&nbsp;QString&nbsp;&amp;&nbsp;source, const&nbsp;QString&nbsp;&amp;&nbsp;desc, const&nbsp;QString&nbsp;&amp;&nbsp;help )</li>
</ul>
<h2>Properties</h2>
<ul>
<li class=fn>QString <a href="#control-prop"><b>control</b></a>&nbsp;- the name of the COM object wrapped by this QAxBase object</li>
</ul>
<h2>Protected Members</h2>
<ul>
<li class=fn>virtual bool <a href="#initialize"><b>initialize</b></a> ( IUnknown&nbsp;**&nbsp;ptr )</li>
<li class=fn>bool <a href="#initializeRemote"><b>initializeRemote</b></a> ( IUnknown&nbsp;**&nbsp;ptr )</li>
<li class=fn>bool <a href="#initializeLicensed"><b>initializeLicensed</b></a> ( IUnknown&nbsp;**&nbsp;ptr )</li>
<li class=fn>bool <a href="#initializeActive"><b>initializeActive</b></a> ( IUnknown&nbsp;**&nbsp;ptr )</li>
</ul>
<hr><a name="details"></a><h2>Detailed Description</h2>
<p> This class is defined in the <b>Qt <a href="activeqt.html#ActiveQt">ActiveQt</a> Extension</b>, which can be found in the <tt>qt/extensions</tt> directory. It is not included in the main Qt API.
<p>

<p> The QAxBase class is an abstract class that provides an API
to initalize and access a COM object.

<p> 

<p> QAxBase is an abstract class that cannot be used directly, and is
instantiated through the subclasses <a href="qaxobject.html">QAxObject</a> and <a href="qaxwidget.html">QAxWidget</a>. This
class provides the API to access the COM object directly
through its IUnknown implementation. If the COM object implements
the IDispatch interface, the properties and methods of that object
become available as Qt properties and slots.
<p> <pre>
    connect( buttonBack, SIGNAL(clicked()), webBrowser, SLOT(GoBack()) );
    </pre>
 
<p> Properties exposed by the object's IDispatch implementation can be
read and written through the property system provided by the Qt
Object Model (both subclasses are QObjects, so you can use <a href="qobject.html#setProperty">setProperty()</a> and <a href="qobject.html#property">property()</a> as with <a href="qobject.html">QObject</a>). Properties
with multiple parameters are not supported.
<p> <pre>
    activeX-&gt;setProperty( "text", "some text" );
    int value = activeX-&gt;property( "value" );
    </pre>
 
<p> Write-functions for properties and other methods exposed by the
object's IDispatch implementation can be called directly using
<a href="#dynamicCall">dynamicCall</a>(), or indirectly as slots connected to a signal.
<p> <pre>
    webBrowser-&gt;dynamicCall( "GoHome()" );
    </pre>
 
<p> Outgoing events supported by the COM object are emitted as
standard Qt signals.
<p> <pre>
    connect( webBrowser, SIGNAL(TitleChanged(const <a href="qstring.html">QString</a>&amp;)),
             this, SLOT(setCaption(const <a href="qstring.html">QString</a>&amp;)) );
    </pre>
 
<p> QAxBase transparently converts between COM data types and the
equivalent Qt data types. Some COM types have no equivalent Qt data structure.
<p> Supported COM datatypes are listed in the first column of following table.
The second column is the Qt type that can be used with the <a href="qobject.html">QObject</a> property
functions. The third column is the Qt type that is used in the prototype of
generated signals and slots for in-parameters, and the last column is the Qt
type that is used in the prototype of signals and slots for out-parameters.
<center><table cellpadding="4" cellspacing="2" border="0">
<tr bgcolor="#a2c511">
<th valign="top">COM type
<th valign="top">Qt property
<th valign="top">in-parameter
<th valign="top">out-parameter
<tr bgcolor="#f0f0f0">
<td valign="top">VARIANT_BOOL
<td valign="top">bool
<td valign="top">bool
<td valign="top">bool&
<tr bgcolor="#d0d0d0">
<td valign="top">BSTR
<td valign="top">QString
<td valign="top">const <a href="qstring.html">QString</a>&
<td valign="top">QString&
<tr bgcolor="#f0f0f0">
<td valign="top">char, short, int, long
<td valign="top">int
<td valign="top">int
<td valign="top">int&
<tr bgcolor="#d0d0d0">
<td valign="top">uchar, ushort, uint, ulong
<td valign="top">uint
<td valign="top">uint
<td valign="top">uint&
<tr bgcolor="#f0f0f0">
<td valign="top">float, double
<td valign="top">double
<td valign="top">double
<td valign="top">double&
<tr bgcolor="#d0d0d0">
<td valign="top">DATE
<td valign="top">QDateTime
<td valign="top">const <a href="qdatetime.html">QDateTime</a>&
<td valign="top">QDateTime&
<tr bgcolor="#f0f0f0">
<td valign="top">CY
<td valign="top">Q_LLONG
<td valign="top">Q_LLONG
<td valign="top">Q_LLONG&
<tr bgcolor="#d0d0d0">
<td valign="top">OLE_COLOR
<td valign="top">QColor
<td valign="top">const <a href="qcolor.html">QColor</a>&
<td valign="top">QColor&
<tr bgcolor="#f0f0f0">
<td valign="top">SAFEARRAY(VARIANT)
<td valign="top">QValueList&lt;QVariant&gt;
<td valign="top">const <a href="qvaluelist.html">QValueList</a>&lt;QVariant&gt;&
<td valign="top">QValueList&lt;QVariant&gt;&
<tr bgcolor="#d0d0d0">
<td valign="top">SAFEARRAY(BYTE)
<td valign="top">QByteArray
<td valign="top">const <a href="qbytearray.html">QByteArray</a>&
<td valign="top">QByteArray&
<tr bgcolor="#f0f0f0">
<td valign="top">SAFEARRAY(BSTR)
<td valign="top">QStringList
<td valign="top">const <a href="qstringlist.html">QStringList</a>&
<td valign="top">QStringList&
<tr bgcolor="#d0d0d0">
<td valign="top">VARIANT
<td valign="top">type-dependent
<td valign="top">const <a href="qvariant.html">QVariant</a>&
<td valign="top">QVariant&
<tr bgcolor="#f0f0f0">
<td valign="top">IFontDisp*
<td valign="top">QFont
<td valign="top">const <a href="qfont.html">QFont</a>&
<td valign="top">QFont&
<tr bgcolor="#d0d0d0">
<td valign="top">IPictureDisp*
<td valign="top">QPixmap
<td valign="top">const <a href="qpixmap.html">QPixmap</a>&
<td valign="top">QPixmap&
<tr bgcolor="#f0f0f0">
<td valign="top">IDispatch*
<td valign="top">QAxObject* (read-only)
<td valign="top"><a href="#asVariant">QAxBase::asVariant</a>()
<td valign="top">QAxObject* (return value)
<tr bgcolor="#d0d0d0">
<td valign="top">IUnknown*
<td valign="top">QAxObject* (read-only)
<td valign="top"><a href="#asVariant">QAxBase::asVariant</a>()
<td valign="top">QAxObject* (return value)
<tr bgcolor="#f0f0f0">
<td valign="top">SCODE, DECIMAL
<td valign="top"><em>unsupported</em>
<td valign="top"><em>unsupported</em>
<td valign="top"><em>unsupported</em>
</table></center>
<p> Supported are also enumerations, and typedefs to supported types.
<p> To call the methods of a COM interface described by the following IDL
<pre>
    dispinterface IControl
    {
    properties:
        [id(1)] BSTR text;
        [id(2)] IFontDisp *font;

    methods:
        [id(6)] void showColumn( [in] int i );
        [id(3)] bool addColumn( [in] BSTR t );
        [id(4)] int fillList( [in, out] SAFEARRAY(VARIANT) *list );
        [id(5)] IDispatch *item( [in] int i );
    };
    </pre>
 
use the QAxBase API like this:
<pre>
    <a href="qaxobject.html">QAxObject</a> object( "&lt;CLSID&gt;" );

    <a href="qstring.html">QString</a> text = object.<a href="qobject.html#property">property</a>( "text" ).toString();
    object.<a href="qobject.html#setProperty">setProperty</a>( "font", QFont( "Times New Roman", 12 ) );

    connect( this, SIGNAL(clicked(int)), &amp;object, SLOT(showColumn(int)) );
    bool ok = object.<a href="#dynamicCall">dynamicCall</a>( "addColumn(const <a href="qstring.html">QString</a>&amp;)", "Column 1" ).toBool();

    <a href="qvaluelist.html">QValueList</a>&lt;QVariant&gt; varlist;
    <a href="qvaluelist.html">QValueList</a>&lt;QVariant&gt; parameters;
    parameters &lt;&lt; QVariant( varlist );
    int n = object.<a href="#dynamicCall">dynamicCall</a>( "fillList(QValueList&lt;QVariant&gt;&amp;)", parameters ).toInt();

    <a href="qaxobject.html">QAxObject</a> *item = object.querySubItem( "item(int)", 5 );
    </pre>
 
<p> Note that the <a href="qvaluelist.html">QValueList</a> the object should fill has to be provided as an
element in the parameter list of QVariants.
<p> If you need to access properties or pass parameters of unsupported
datatypes you must access the COM object directly through its
IDispatch implementation or other interfaces. Those interfaces can be 
retrieved through <a href="#queryInterface">queryInterface</a>().
<p> <pre>
    IUnknown *iface = 0;
    activeX-&gt;queryInterface( IID_IUnknown, (void**)&amp;iface );
    if ( iface ) {
        // use the interface
        iface-&gt;Release();
    }
    </pre>
 
<p> To get the definition of the COM interfaces you will have to use the header
files provided with the component you want to use. Some compilers can also
import type libraries using the #import compiler directive. See the component
documentation to find out which type libraries you have to import, and how to use
them.
<p> If you need to react to events that pass parameters of unsupported
datatypes you can use the generic signal that delivers the event
data as provided by the COM event.

<hr><h2>Member Type Documentation</h2>
<h3 class=fn><a name="PropertyBag-enum"></a>QAxBase::PropertyBag</h3>

<p> A <a href="qmap.html">QMap</a><QString,QVariant> that can store properties as name:value pairs.

<hr><h2>Member Function Documentation</h2>
<h3 class=fn><a name="QAxBase"></a>QAxBase::QAxBase ( IUnknown&nbsp;*&nbsp;iface = 0 )
</h3>
Creates a QAxBase object that wraps the COM object <em>iface</em>. If <em>iface</em> is 0 (the default), use <a href="#setControl">setControl</a>() to instantiate a COM
object.

<h3 class=fn><a name="~QAxBase"></a>QAxBase::~QAxBase ()<tt> [virtual]</tt>
</h3>
Shuts down the COM object and destroys the QAxBase object.
<p> <p>See also <a href="#clear">clear</a>().

<h3 class=fn><a href="qvariant.html">QVariant</a> <a name="asVariant"></a>QAxBase::asVariant () const
</h3>
Returns a <a href="qvariant.html">QVariant</a> that wraps the COM object. The variant can
then be used as a parameter in e.g. <a href="#dynamicCall">dynamicCall</a>().

<h3 class=fn>void <a name="clear"></a>QAxBase::clear ()<tt> [virtual]</tt>
</h3>
Disconnects and destroys the COM object.
<p> If you reimplement this function you must also reimplement the
destructor to call <a href="#clear">clear</a>(), and call this implementation at the
end of your clear() function.

<h3 class=fn><a href="qstring.html">QString</a> <a name="control"></a>QAxBase::control () const
</h3><p>Returns the name of the COM object wrapped by this QAxBase object.
See the <a href="qaxbase.html#control-prop">"control"</a> property for details.
<h3 class=fn>void <a name="disableClassInfo"></a>QAxBase::disableClassInfo ()
</h3>
Disables the class info generation for this ActiveX container. If
you don't require any class information about the ActiveX control
use this function to speed up the <a href="metaobjects.html#meta-object">meta object</a> generation.
<p> Note that this function must be called immediately after
construction of the object (without passing an object identifier),
and before calling <a href="qaxwidget.html">QAxWidget</a>->setControl().

<h3 class=fn>void <a name="disableEventSink"></a>QAxBase::disableEventSink ()
</h3>
Disables the event sink implementation for this ActiveX container.
If you don't intend to listen to the ActiveX control's events use
this function to speed up the <a href="metaobjects.html#meta-object">meta object</a> generation.
<p> Some ActiveX controls might be unstable when connected to an event
sink. To get OLE events you must use standard COM methods to
register your own event sink. Use <a href="#queryInterface">queryInterface</a>() to get access
to the raw COM object.
<p> Note that this function should be called immediately after
construction of the object (without passing an object identifier),
and before calling <a href="qaxwidget.html">QAxWidget</a>->setControl().

<h3 class=fn>void <a name="disableMetaObject"></a>QAxBase::disableMetaObject ()
</h3>
Disables the <a href="metaobjects.html#meta-object">meta object</a> generation for this ActiveX container.
This also disables the event sink and class info generation. If
you don't intend to use the Qt meta object implementation call
this function to speed up the meta object generation.
<p> Some ActiveX controls might be unstable when used with OLE
automation. Use standard COM methods to use those controls through
the COM interfaces provided by <a href="#queryInterface">queryInterface</a>().
<p> Note that this function must be called immediately after
construction of the object (without passing an object identifier),
and before calling <a href="qaxwidget.html">QAxWidget</a>->setControl().

<h3 class=fn><a href="qvariant.html">QVariant</a> <a name="dynamicCall"></a>QAxBase::dynamicCall ( const&nbsp;<a href="qcstring.html">QCString</a>&nbsp;&amp;&nbsp;function, const&nbsp;<a href="qvariant.html">QVariant</a>&nbsp;&amp;&nbsp;var1 = QVariant ( ), const&nbsp;<a href="qvariant.html">QVariant</a>&nbsp;&amp;&nbsp;var2 = QVariant ( ), const&nbsp;<a href="qvariant.html">QVariant</a>&nbsp;&amp;&nbsp;var3 = QVariant ( ), const&nbsp;<a href="qvariant.html">QVariant</a>&nbsp;&amp;&nbsp;var4 = QVariant ( ), const&nbsp;<a href="qvariant.html">QVariant</a>&nbsp;&amp;&nbsp;var5 = QVariant ( ), const&nbsp;<a href="qvariant.html">QVariant</a>&nbsp;&amp;&nbsp;var6 = QVariant ( ), const&nbsp;<a href="qvariant.html">QVariant</a>&nbsp;&amp;&nbsp;var7 = QVariant ( ), const&nbsp;<a href="qvariant.html">QVariant</a>&nbsp;&amp;&nbsp;var8 = QVariant ( ) )
</h3>
Calls the COM object's method <em>function</em>, passing the
parameters <em>var1</em>, <em>var1</em>, <em>var2</em>, <em>var3</em>, <em>var4</em>, <em>var5</em>,
<em>var6</em>, <em>var7</em> and <em>var8</em>, and returns the value returned by
the method, or an invalid <a href="qvariant.html">QVariant</a> if the method does not return
a value or when the function call failed.
<p> If <em>function</em> is a method of the object the string must be provided
as the full prototype, for example as it would be written in a
<a href="qobject.html#connect">QObject::connect</a>() call.
<pre>
    activeX-&gt;dynamicCall( "Navigate(const <a href="qstring.html">QString</a>&amp;)", "www.trolltech.com" );
    </pre>
 
<p> Alternatively a function can be called passing the parameters embedded
in the string, e.g. above function can also be invoked using
<pre>
    activeX-&gt;dynamicCall("Navigate(\"www.trolltech.com\");
    </pre>
 
All parameters are passed as strings; it depends on the control whether
they are interpreted correctly, and is slower than using the prototype
with correctly typed parameters.
<p> If <em>function</em> is a property the string has to be the name of the
property. The property setter is called when <em>var1</em> is a valid QVariant,
otherwise the getter is called.
<pre>
    activeX-&gt;dynamicCall( "Value", 5 );
    <a href="qstring.html">QString</a> text = activeX-&gt;dynamicCall( "Text" ).toString();
    </pre>
 
Note that it is faster to get and set properties using
<a href="qobject.html#property">QObject::property</a>() and <a href="qobject.html#setProperty">QObject::setProperty</a>().
<p> It is only possible to call functions through <a href="#dynamicCall">dynamicCall</a>() that
have parameters or return values of datatypes supported by
<a href="qvariant.html">QVariant</a>. See the QAxBase class documentation for a list of
supported and unsupported datatypes. If you want to call functions
that have unsupported datatypes in the parameter list, use
<a href="#queryInterface">queryInterface</a>() to retrieve the appropriate COM interface, and
use the function directly.
<p> <pre>
    IWebBrowser2 *webBrowser = 0;
    activeX-&gt;queryInterface( IID_IWebBrowser2, (void**)&amp;webBrowser );
    if ( webBrowser ) {
        webBrowser-&gt;Navigate2( pvarURL );
        webBrowser-&gt;Release();
    }
    </pre>
 
<p> This is also more efficient.

<p>Example: <a href="qaxcontainer-example-qutlook.html#x2720">qutlook/centralwidget.cpp</a>.
<h3 class=fn><a href="qvariant.html">QVariant</a> <a name="dynamicCall-2"></a>QAxBase::dynamicCall ( const&nbsp;<a href="qcstring.html">QCString</a>&nbsp;&amp;&nbsp;function, <a href="qvaluelist.html">QValueList</a>&lt;QVariant&gt;&nbsp;&amp;&nbsp;vars )
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Calls the COM object's method <em>function</em>, passing the
parameters in <em>vars</em>, and returns the value returned by
the method. If the method does not return a value or when
the function call failed this function returns an invalid
<a href="qvariant.html">QVariant</a> object.
<p> The QVariant objects in <em>vars</em> are updated when the method has
out-parameters.

<h3 class=fn>void <a name="exception"></a>QAxBase::exception ( int&nbsp;code, const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;source, const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;desc, const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;help )<tt> [signal]</tt>
</h3>

<p> This signal is emitted when the COM object throws an exception while called using the OLE automation
interface IDispatch. <em>code</em>, <em>source</em>, <em>desc</em> and <em>help</em> provide information about the exception as
provided by the COM server and can be used to provide useful feedback to the end user. <em>help</em> includes
the help file, and the help context ID in brackets, e.g. "filename [id]".

<h3 class=fn><a href="qstring.html">QString</a> <a name="generateDocumentation"></a>QAxBase::generateDocumentation ()
</h3>

<p> Returns a rich text string with documentation for the
wrapped COM object. Dump the string to an HTML-file,
or use it in e.g. a <a href="qtextbrowser.html">QTextBrowser</a> widget.

<h3 class=fn>bool <a name="initialize"></a>QAxBase::initialize ( IUnknown&nbsp;**&nbsp;ptr )<tt> [virtual protected]</tt>
</h3>
This virtual function is called by <a href="#setControl">setControl</a>() and creates the
requested COM object. <em>ptr</em> is set to the object's IUnknown 
implementation. The function returns TRUE if the object 
initialization succeeded; otherwise the function returns FALSE.
<p> The default implementation interprets the string returned by
<a href="#control">control</a>(), and calls <a href="#initializeRemote">initializeRemote</a>(), <a href="#initializeLicensed">initializeLicensed</a>()
or <a href="#initializeActive">initializeActive</a>() if the string matches the respective 
patterns. If no pattern is matched, or if remote or licensed 
initialization fails, CoCreateInstance is used directly to create 
the object.
<p> See the <a href="#control-prop">control</a> property documentation for details about
supported patterns.
<p> The interface returned in <em>ptr</em> must be referenced exactly once
when this function returns. The interface provided by e.g.
CoCreateInstance is already referenced, and there is no need to
reference it again.

<h3 class=fn>bool <a name="initializeActive"></a>QAxBase::initializeActive ( IUnknown&nbsp;**&nbsp;ptr )<tt> [protected]</tt>
</h3>
Returns an active instance running on the current machine, and returns the
IUnknown interface to the running object in <em>ptr</em>. This function returns TRUE 
if successful, otherwise returns FALSE.
<p> This function is called by <a href="#initialize">initialize</a>() if the control string contains the 
substring "}&".
<p> <p>See also <a href="#initialize">initialize</a>().

<h3 class=fn>bool <a name="initializeLicensed"></a>QAxBase::initializeLicensed ( IUnknown&nbsp;**&nbsp;ptr )<tt> [protected]</tt>
</h3>
Creates an instance of a licensed control, and returns the IUnknown interface
to the object in <em>ptr</em>. This functions returns TRUE if successful, otherwise
returns FALSE.
<p> This function is called by <a href="#initialize">initialize</a>() if the control string contains the 
substring "}:". The license key needs to follow this substring.
<p> <p>See also <a href="#initialize">initialize</a>().

<h3 class=fn>bool <a name="initializeRemote"></a>QAxBase::initializeRemote ( IUnknown&nbsp;**&nbsp;ptr )<tt> [protected]</tt>
</h3>
Creates the instance on a remote server, and returns the IUnknown interface
to the object in <em>ptr</em>. This function returns TRUE if successful, otherwise
returns FALSE.
<p> This function is called by <a href="#initialize">initialize</a>() if the control string contains the 
substring "/{". The information about the remote machine needs to be provided
in front of the substring.
<p> <p>See also <a href="#initialize">initialize</a>().

<h3 class=fn>bool <a name="isNull"></a>QAxBase::isNull () const
</h3>
Returns TRUE if there is no COM object loaded by this wrapper;
otherwise return FALSE.
<p> <p>See also <a href="#control-prop">control</a>.

<h3 class=fn><a href="qaxbase.html#PropertyBag-enum">PropertyBag</a> <a name="propertyBag"></a>QAxBase::propertyBag () const
</h3>
Returns a name:value map of all the properties exposed by the COM
object.
<p> This is more efficient than getting multiple properties
individually if the COM object supports property bags.
<p> <b>Warning:</b> It is not guaranteed that the property bag implementation
of the COM object returns all properties, or that the properties
returned are the same as those available through the IDispatch
interface.

<h3 class=fn>void <a name="propertyChanged"></a>QAxBase::propertyChanged ( const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;name )<tt> [signal]</tt>
</h3>

<p> If the COM object supports property notification, this signal gets
emitted when the property called <em>name</em> is changed.

<h3 class=fn>bool <a name="propertyWritable"></a>QAxBase::propertyWritable ( const&nbsp;char&nbsp;*&nbsp;prop ) const<tt> [virtual]</tt>
</h3>
Returns TRUE if the property <em>prop</em> is writable; otherwise
returns FALSE. By default, all properties are writable.
<p> <b>Warning:</b>
Depending on the control implementation this setting might be
ignored for some properties.
<p> <p>See also <a href="#setPropertyWritable">setPropertyWritable</a>() and <a href="#propertyChanged">propertyChanged</a>().

<h3 class=fn>long <a name="queryInterface"></a>QAxBase::queryInterface ( const&nbsp;<a href="quuid.html">QUuid</a>&nbsp;&amp;&nbsp;uuid, void&nbsp;**&nbsp;iface ) const
</h3>
Requests the interface <em>uuid</em> from the COM object and sets the
value of <em>iface</em> to the provided interface, or to 0 if the
requested interface could not be provided.
<p> Returns the result of the QueryInterface implementation of the COM object.
<p> <p>See also <a href="#control-prop">control</a>.

<h3 class=fn><a href="qaxobject.html">QAxObject</a>&nbsp;* <a name="querySubObject"></a>QAxBase::querySubObject ( const&nbsp;<a href="qcstring.html">QCString</a>&nbsp;&amp;&nbsp;name, const&nbsp;<a href="qvariant.html">QVariant</a>&nbsp;&amp;&nbsp;var1 = QVariant ( ), const&nbsp;<a href="qvariant.html">QVariant</a>&nbsp;&amp;&nbsp;var2 = QVariant ( ), const&nbsp;<a href="qvariant.html">QVariant</a>&nbsp;&amp;&nbsp;var3 = QVariant ( ), const&nbsp;<a href="qvariant.html">QVariant</a>&nbsp;&amp;&nbsp;var4 = QVariant ( ), const&nbsp;<a href="qvariant.html">QVariant</a>&nbsp;&amp;&nbsp;var5 = QVariant ( ), const&nbsp;<a href="qvariant.html">QVariant</a>&nbsp;&amp;&nbsp;var6 = QVariant ( ), const&nbsp;<a href="qvariant.html">QVariant</a>&nbsp;&amp;&nbsp;var7 = QVariant ( ), const&nbsp;<a href="qvariant.html">QVariant</a>&nbsp;&amp;&nbsp;var8 = QVariant ( ) )
</h3>
Returns a pointer to a <a href="qaxobject.html">QAxObject</a> wrapping the COM object provided
by the method or property <em>name</em>, passing passing the parameters
<em>var1</em>, <em>var1</em>, <em>var2</em>, <em>var3</em>, <em>var4</em>, <em>var5</em>, <em>var6</em>,
<em>var7</em> and <em>var8</em>.
<p> If <em>name</em> is provided by a method the string must include the
full function prototype.
<p> If <em>name</em> is a property the string must be the name of the property,
and <em>var1</em>, ... <em>var8</em> are ignored.
<p> The returned QAxObject is a child of this object (which is either of
type QAxObject or <a href="qaxwidget.html">QAxWidget</a>), and is deleted when this object is
deleted. It is however safe to delete the returned object yourself,
and you should do so when you iterate over lists of subobjects.
<p> COM enabled applications usually have an object model publishing
certain elements of the application as dispatch interfaces. Use
this method to navigate the hierarchy of the object model, e.g.
<p> <pre>
    <a href="qaxwidget.html">QAxWidget</a> outlook( "Outlook.Application" );
    <a href="qaxobject.html">QAxObject</a> *session = outlook.<a href="#querySubObject">querySubObject</a>( "Session" );
    if ( session ) {
        <a href="qaxobject.html">QAxObject</a> *defFolder = session-&gt;<a href="#querySubObject">querySubObject</a>(
                                "GetDefaultFolder(OlDefaultFolders)",
                                "olFolderContacts" );
        //...
    }
    </pre>
 

<p>Example: <a href="qaxcontainer-example-qutlook.html#x2721">qutlook/centralwidget.cpp</a>.
<h3 class=fn>bool <a name="setControl"></a>QAxBase::setControl ( const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp; )
</h3><p>Sets the name of the COM object wrapped by this QAxBase object.
See the <a href="qaxbase.html#control-prop">"control"</a> property for details.
<h3 class=fn>void <a name="setPropertyBag"></a>QAxBase::setPropertyBag ( const&nbsp;<a href="qaxbase.html#PropertyBag-enum">PropertyBag</a>&nbsp;&amp;&nbsp;bag )
</h3>
Sets the properties of the COM object to the corresponding values
in <em>bag</em>.
<p> <b>Warning:</b>
You should only set property bags that have been returned by the
propertyBag function, as it cannot be guaranteed that the property
bag implementation of the COM object supports the same properties
that are available through the IDispatch interface.
<p> <p>See also <a href="#propertyBag">propertyBag</a>().

<h3 class=fn>void <a name="setPropertyWritable"></a>QAxBase::setPropertyWritable ( const&nbsp;char&nbsp;*&nbsp;prop, bool&nbsp;ok )<tt> [virtual]</tt>
</h3>
Sets the property <em>prop</em> to writable if <em>ok</em> is TRUE, otherwise
sets <em>prop</em> to be read-only. By default, all properties are
writable.
<p> <b>Warning:</b>
Depending on the control implementation this setting might be
ignored for some properties.
<p> <p>See also <a href="#propertyWritable">propertyWritable</a>() and <a href="#propertyChanged">propertyChanged</a>().

<h3 class=fn>void <a name="signal"></a>QAxBase::signal ( const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;name, int&nbsp;argc, void&nbsp;*&nbsp;argv )<tt> [signal]</tt>
</h3>

<p> This generic signal gets emitted when the COM object issues the
event <em>name</em>. <em>argc</em> is the number of parameters provided by the
event (DISPPARAMS.cArgs), and <em>argv</em> is the pointer to the
parameter values (DISPPARAMS.rgvarg). Note that the order of parameter
values is turned around, ie. the last element of the array is the first
parameter in the function.
<p> <pre>
    void Receiver::slot( const <a href="qstring.html">QString</a> &amp;name, int argc, void *argv )
    {
        VARIANTARG *params = (VARIANTARG*)argv;
        if ( name.<a href="qstring.html#startsWith">startsWith</a>( "BeforeNavigate2(" ) ) {
            IDispatch *pDisp = params[argc-1].pdispVal;
            VARIANTARG URL = *params[argc-2].pvarVal;
            VARIANTARG Flags = *params[argc-3].pvarVal;
            VARIANTARG TargetFrameName = *params[argc-4].pvarVal;
            VARIANTARG PostData = *params[argc-5].pvarVal;
            VARIANTARG Headers = *params[argc-6].pvarVal;
            bool *Cancel = params[argc-7].pboolVal;
        }
    }
    </pre>
 
<p> Use this signal if the event has parameters of unsupported data
types. Otherwise, connect directly to the signal <em>name</em>.

<hr><h2>Property Documentation</h2>
<h3 class=fn><a href="qstring.html">QString</a> <a name="control-prop"></a>control</h3>
<p>This property holds the name of the COM object wrapped by this QAxBase object.
<p>Setting this property initilializes the COM object. Any COM object
previously set is shut down.
<p> The most efficient way to set this property is by using the
registered component's UUID, e.g.
<pre>
    ctrl-&gt;setControl( "{8E27C92B-1264-101C-8A2F-040224009C02}" );
    </pre>
 
The second fastest way is to use the registered control's class
name (with or without version number), e.g.
<pre>
    ctrl-&gt;setControl( "MSCal.Calendar" );
    </pre>
 
The slowest, but easiest way to use is to use the control's full
name, e.g.
<pre>
    ctrl-&gt;setControl( "Calendar Control 9.0" );
    </pre>
 
<p> If the component's UUID is used the following patterns can be used
to initialize the control on a remote machine, to initialize a
licensed control or to connect to a running object:
<ul>
<li> To initialize the control on a different machine use the following
pattern:
<pre>
    &lt;domain/username&gt;:&lt;password&gt;@server/{8E27C92B-1264-101C-8A2F-040224009C02}
    </pre>
 
<li> To initialize a licensed control use the following pattern:
<pre>
    {8E27C92B-1264-101C-8A2F-040224009C02}:&lt;LicenseKey&gt;
    </pre>
 
<li> To connect to an already running object use the following pattern:
<pre>
    {8E27C92B-1264-101C-8A2F-040224009C02}&amp;
    </pre>
 
</ul>
The first two patterns can be combined, e.g. to initialize a licensed
control on a remote machine:
<pre>
    ctrl-&gt;setControl("DOMAIN/user:password@server/{8E27C92B-1264-101C-8A2F-040224009C02}:LicenseKey");
    </pre>
 
<p> The control's read function always returns the control's UUID, if provided including the license
key, and the name of the server, but not including the username, the domain or the password.

<p>Set this property's value with <a href="#setControl">setControl</a>() and get this property's value with <a href="#control">control</a>().
<!-- eof -->
<hr><p>
This file is part of the <a href="index.html">Qt toolkit</a>.
Copyright &copy; 1995-2007
<a href="http://www.trolltech.com/">Trolltech</a>. All Rights Reserved.<p><address><hr><div align=center>
<table width=100% cellspacing=0 border=0><tr>
<td>Copyright &copy; 2007
<a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a>
<td align=right><div align=right>Qt 3.3.8</div>
</table></div></address></body>
</html>