You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
tqt3/doc/html/qaxbase.html

659 lines
35 KiB

<!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>TQAxBase 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>TQAxBase Class Reference<br><small>[<a href="qaxcontainer.html">TQAxContainer module</a>]</small></h1>
<p>The TQAxBase 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>TQt ActiveTQt Extension</b>.
<p><tt>#include &lt;<a href="qaxbase-h.html">qaxbase.h</a>&gt;</tt>
<p>Inherited by <a href="qaxobject.html">TQAxObject</a> and <a href="qaxwidget.html">TQAxWidget</a>.
<p><a href="qaxbase-members.html">List of all member functions.</a>
<h2>Public Members</h2>
<ul>
<li class=fn><a href="#TQAxBase"><b>TQAxBase</b></a> ( IUnknown&nbsp;*&nbsp;iface = 0 )</li>
<li class=fn>virtual <a href="#~TQAxBase"><b>~TQAxBase</b></a> ()</li>
<li class=fn>TQString <a href="#control"><b>control</b></a> () const</li>
<li class=fn>long <a href="#queryInterface"><b>queryInterface</b></a> ( const&nbsp;TQUuid&nbsp;&amp;&nbsp;uuid, void&nbsp;**&nbsp;iface ) const</li>
<li class=fn>TQVariant <a href="#dynamicCall"><b>dynamicCall</b></a> ( const&nbsp;TQCString&nbsp;&amp;&nbsp;function, const&nbsp;TQVariant&nbsp;&amp;&nbsp;var1 = TQVariant ( ), const&nbsp;TQVariant&nbsp;&amp;&nbsp;var2 = TQVariant ( ), const&nbsp;TQVariant&nbsp;&amp;&nbsp;var3 = TQVariant ( ), const&nbsp;TQVariant&nbsp;&amp;&nbsp;var4 = TQVariant ( ), const&nbsp;TQVariant&nbsp;&amp;&nbsp;var5 = TQVariant ( ), const&nbsp;TQVariant&nbsp;&amp;&nbsp;var6 = TQVariant ( ), const&nbsp;TQVariant&nbsp;&amp;&nbsp;var7 = TQVariant ( ), const&nbsp;TQVariant&nbsp;&amp;&nbsp;var8 = TQVariant ( ) )</li>
<li class=fn>TQVariant <a href="#dynamicCall-2"><b>dynamicCall</b></a> ( const&nbsp;TQCString&nbsp;&amp;&nbsp;function, TQValueList&lt;TQVariant&gt;&nbsp;&amp;&nbsp;vars )</li>
<li class=fn>TQAxObject * <a href="#querySubObject"><b>querySubObject</b></a> ( const&nbsp;TQCString&nbsp;&amp;&nbsp;name, const&nbsp;TQVariant&nbsp;&amp;&nbsp;var1 = TQVariant ( ), const&nbsp;TQVariant&nbsp;&amp;&nbsp;var2 = TQVariant ( ), const&nbsp;TQVariant&nbsp;&amp;&nbsp;var3 = TQVariant ( ), const&nbsp;TQVariant&nbsp;&amp;&nbsp;var4 = TQVariant ( ), const&nbsp;TQVariant&nbsp;&amp;&nbsp;var5 = TQVariant ( ), const&nbsp;TQVariant&nbsp;&amp;&nbsp;var6 = TQVariant ( ), const&nbsp;TQVariant&nbsp;&amp;&nbsp;var7 = TQVariant ( ), const&nbsp;TQVariant&nbsp;&amp;&nbsp;var8 = TQVariant ( ) )</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>TQString <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>TQVariant <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 TQString &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;TQString&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;TQString&nbsp;&amp;&nbsp;name )</li>
<li class=fn>void <a href="#exception"><b>exception</b></a> ( int&nbsp;code, const&nbsp;TQString&nbsp;&amp;&nbsp;source, const&nbsp;TQString&nbsp;&amp;&nbsp;desc, const&nbsp;TQString&nbsp;&amp;&nbsp;help )</li>
</ul>
<h2>Properties</h2>
<ul>
<li class=fn>TQString <a href="#control-prop"><b>control</b></a>&nbsp;- the name of the COM object wrapped by this TQAxBase 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>TQt <a href="activentqt.html#ActiveTQt">ActiveTQt</a> Extension</b>, which can be found in the <tt>qt/extensions</tt> directory. It is not included in the main TQt API.
<p>
<p> The TQAxBase class is an abstract class that provides an API
to initalize and access a COM object.
<p>
<p> TQAxBase is an abstract class that cannot be used directly, and is
instantiated through the subclasses <a href="qaxobject.html">TQAxObject</a> and <a href="qaxwidget.html">TQAxWidget</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 TQt 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 TQt
Object Model (both subclasses are TQObjects, so you can use <a href="ntqobject.html#setProperty">setProperty()</a> and <a href="ntqobject.html#property">property()</a> as with <a href="ntqobject.html">TQObject</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 TQt signals.
<p> <pre>
connect( webBrowser, SIGNAL(TitleChanged(const <a href="ntqstring.html">TQString</a>&amp;)),
this, SLOT(setCaption(const <a href="ntqstring.html">TQString</a>&amp;)) );
</pre>
<p> TQAxBase transparently converts between COM data types and the
equivalent TQt data types. Some COM types have no equivalent TQt data structure.
<p> Supported COM datatypes are listed in the first column of following table.
The second column is the TQt type that can be used with the <a href="ntqobject.html">TQObject</a> property
functions. The third column is the TQt type that is used in the prototype of
generated signals and slots for in-parameters, and the last column is the TQt
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">TQt 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">TQString
<td valign="top">const <a href="ntqstring.html">TQString</a>&
<td valign="top">TQString&
<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">TQDateTime
<td valign="top">const <a href="ntqdatetime.html">TQDateTime</a>&
<td valign="top">TQDateTime&
<tr bgcolor="#f0f0f0">
<td valign="top">CY
<td valign="top">TQ_LLONG
<td valign="top">TQ_LLONG
<td valign="top">TQ_LLONG&
<tr bgcolor="#d0d0d0">
<td valign="top">OLE_COLOR
<td valign="top">TQColor
<td valign="top">const <a href="ntqcolor.html">TQColor</a>&
<td valign="top">TQColor&
<tr bgcolor="#f0f0f0">
<td valign="top">SAFEARRAY(VARIANT)
<td valign="top">TQValueList&lt;TQVariant&gt;
<td valign="top">const <a href="ntqvaluelist.html">TQValueList</a>&lt;TQVariant&gt;&
<td valign="top">TQValueList&lt;TQVariant&gt;&
<tr bgcolor="#d0d0d0">
<td valign="top">SAFEARRAY(BYTE)
<td valign="top">TQByteArray
<td valign="top">const <a href="qbytearray.html">TQByteArray</a>&
<td valign="top">TQByteArray&
<tr bgcolor="#f0f0f0">
<td valign="top">SAFEARRAY(BSTR)
<td valign="top">TQStringList
<td valign="top">const <a href="ntqstringlist.html">TQStringList</a>&
<td valign="top">TQStringList&
<tr bgcolor="#d0d0d0">
<td valign="top">VARIANT
<td valign="top">type-dependent
<td valign="top">const <a href="ntqvariant.html">TQVariant</a>&
<td valign="top">TQVariant&
<tr bgcolor="#f0f0f0">
<td valign="top">IFontDisp*
<td valign="top">TQFont
<td valign="top">const <a href="ntqfont.html">TQFont</a>&
<td valign="top">TQFont&
<tr bgcolor="#d0d0d0">
<td valign="top">IPictureDisp*
<td valign="top">TQPixmap
<td valign="top">const <a href="ntqpixmap.html">TQPixmap</a>&
<td valign="top">TQPixmap&
<tr bgcolor="#f0f0f0">
<td valign="top">IDispatch*
<td valign="top">TQAxObject* (read-only)
<td valign="top"><a href="#asVariant">TQAxBase::asVariant</a>()
<td valign="top">TQAxObject* (return value)
<tr bgcolor="#d0d0d0">
<td valign="top">IUnknown*
<td valign="top">TQAxObject* (read-only)
<td valign="top"><a href="#asVariant">TQAxBase::asVariant</a>()
<td valign="top">TQAxObject* (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 TQAxBase API like this:
<pre>
<a href="qaxobject.html">TQAxObject</a> object( "&lt;CLSID&gt;" );
<a href="ntqstring.html">TQString</a> text = object.<a href="ntqobject.html#property">property</a>( "text" ).toString();
object.<a href="ntqobject.html#setProperty">setProperty</a>( "font", TQFont( "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="ntqstring.html">TQString</a>&amp;)", "Column 1" ).toBool();
<a href="ntqvaluelist.html">TQValueList</a>&lt;TQVariant&gt; varlist;
<a href="ntqvaluelist.html">TQValueList</a>&lt;TQVariant&gt; parameters;
parameters &lt;&lt; TQVariant( varlist );
int n = object.<a href="#dynamicCall">dynamicCall</a>( "fillList(TQValueList&lt;TQVariant&gt;&amp;)", parameters ).toInt();
<a href="qaxobject.html">TQAxObject</a> *item = object.querySubItem( "item(int)", 5 );
</pre>
<p> Note that the <a href="ntqvaluelist.html">TQValueList</a> the object should fill has to be provided as an
element in the parameter list of TQVariants.
<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>TQAxBase::PropertyBag</h3>
<p> A <a href="ntqmap.html">TQMap</a><TQString,TQVariant> that can store properties as name:value pairs.
<hr><h2>Member Function Documentation</h2>
<h3 class=fn><a name="TQAxBase"></a>TQAxBase::TQAxBase ( IUnknown&nbsp;*&nbsp;iface = 0 )
</h3>
Creates a TQAxBase 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="~TQAxBase"></a>TQAxBase::~TQAxBase ()<tt> [virtual]</tt>
</h3>
Shuts down the COM object and destroys the TQAxBase object.
<p> <p>See also <a href="#clear">clear</a>().
<h3 class=fn><a href="ntqvariant.html">TQVariant</a> <a name="asVariant"></a>TQAxBase::asVariant () const
</h3>
Returns a <a href="ntqvariant.html">TQVariant</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>TQAxBase::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="ntqstring.html">TQString</a> <a name="control"></a>TQAxBase::control () const
</h3><p>Returns the name of the COM object wrapped by this TQAxBase object.
See the <a href="qaxbase.html#control-prop">"control"</a> property for details.
<h3 class=fn>void <a name="disableClassInfo"></a>TQAxBase::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">TQAxWidget</a>->setControl().
<h3 class=fn>void <a name="disableEventSink"></a>TQAxBase::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">TQAxWidget</a>->setControl().
<h3 class=fn>void <a name="disableMetaObject"></a>TQAxBase::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 TQt 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">TQAxWidget</a>->setControl().
<h3 class=fn><a href="ntqvariant.html">TQVariant</a> <a name="dynamicCall"></a>TQAxBase::dynamicCall ( const&nbsp;<a href="ntqcstring.html">TQCString</a>&nbsp;&amp;&nbsp;function, const&nbsp;<a href="ntqvariant.html">TQVariant</a>&nbsp;&amp;&nbsp;var1 = TQVariant ( ), const&nbsp;<a href="ntqvariant.html">TQVariant</a>&nbsp;&amp;&nbsp;var2 = TQVariant ( ), const&nbsp;<a href="ntqvariant.html">TQVariant</a>&nbsp;&amp;&nbsp;var3 = TQVariant ( ), const&nbsp;<a href="ntqvariant.html">TQVariant</a>&nbsp;&amp;&nbsp;var4 = TQVariant ( ), const&nbsp;<a href="ntqvariant.html">TQVariant</a>&nbsp;&amp;&nbsp;var5 = TQVariant ( ), const&nbsp;<a href="ntqvariant.html">TQVariant</a>&nbsp;&amp;&nbsp;var6 = TQVariant ( ), const&nbsp;<a href="ntqvariant.html">TQVariant</a>&nbsp;&amp;&nbsp;var7 = TQVariant ( ), const&nbsp;<a href="ntqvariant.html">TQVariant</a>&nbsp;&amp;&nbsp;var8 = TQVariant ( ) )
</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="ntqvariant.html">TQVariant</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="ntqobject.html#connect">TQObject::connect</a>() call.
<pre>
activeX-&gt;dynamicCall( "Navigate(const <a href="ntqstring.html">TQString</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 TQVariant,
otherwise the getter is called.
<pre>
activeX-&gt;dynamicCall( "Value", 5 );
<a href="ntqstring.html">TQString</a> text = activeX-&gt;dynamicCall( "Text" ).toString();
</pre>
Note that it is faster to get and set properties using
<a href="ntqobject.html#property">TQObject::property</a>() and <a href="ntqobject.html#setProperty">TQObject::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="ntqvariant.html">TQVariant</a>. See the TQAxBase 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="ntqvariant.html">TQVariant</a> <a name="dynamicCall-2"></a>TQAxBase::dynamicCall ( const&nbsp;<a href="ntqcstring.html">TQCString</a>&nbsp;&amp;&nbsp;function, <a href="ntqvaluelist.html">TQValueList</a>&lt;TQVariant&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="ntqvariant.html">TQVariant</a> object.
<p> The TQVariant objects in <em>vars</em> are updated when the method has
out-parameters.
<h3 class=fn>void <a name="exception"></a>TQAxBase::exception ( int&nbsp;code, const&nbsp;<a href="ntqstring.html">TQString</a>&nbsp;&amp;&nbsp;source, const&nbsp;<a href="ntqstring.html">TQString</a>&nbsp;&amp;&nbsp;desc, const&nbsp;<a href="ntqstring.html">TQString</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="ntqstring.html">TQString</a> <a name="generateDocumentation"></a>TQAxBase::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="ntqtextbrowser.html">TQTextBrowser</a> widget.
<h3 class=fn>bool <a name="initialize"></a>TQAxBase::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>TQAxBase::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>TQAxBase::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>TQAxBase::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>TQAxBase::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>TQAxBase::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>TQAxBase::propertyChanged ( const&nbsp;<a href="ntqstring.html">TQString</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>TQAxBase::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>TQAxBase::queryInterface ( const&nbsp;<a href="ntquuid.html">TQUuid</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">TQAxObject</a>&nbsp;* <a name="querySubObject"></a>TQAxBase::querySubObject ( const&nbsp;<a href="ntqcstring.html">TQCString</a>&nbsp;&amp;&nbsp;name, const&nbsp;<a href="ntqvariant.html">TQVariant</a>&nbsp;&amp;&nbsp;var1 = TQVariant ( ), const&nbsp;<a href="ntqvariant.html">TQVariant</a>&nbsp;&amp;&nbsp;var2 = TQVariant ( ), const&nbsp;<a href="ntqvariant.html">TQVariant</a>&nbsp;&amp;&nbsp;var3 = TQVariant ( ), const&nbsp;<a href="ntqvariant.html">TQVariant</a>&nbsp;&amp;&nbsp;var4 = TQVariant ( ), const&nbsp;<a href="ntqvariant.html">TQVariant</a>&nbsp;&amp;&nbsp;var5 = TQVariant ( ), const&nbsp;<a href="ntqvariant.html">TQVariant</a>&nbsp;&amp;&nbsp;var6 = TQVariant ( ), const&nbsp;<a href="ntqvariant.html">TQVariant</a>&nbsp;&amp;&nbsp;var7 = TQVariant ( ), const&nbsp;<a href="ntqvariant.html">TQVariant</a>&nbsp;&amp;&nbsp;var8 = TQVariant ( ) )
</h3>
Returns a pointer to a <a href="qaxobject.html">TQAxObject</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 TQAxObject is a child of this object (which is either of
type TQAxObject or <a href="qaxwidget.html">TQAxWidget</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">TQAxWidget</a> outlook( "Outlook.Application" );
<a href="qaxobject.html">TQAxObject</a> *session = outlook.<a href="#querySubObject">querySubObject</a>( "Session" );
if ( session ) {
<a href="qaxobject.html">TQAxObject</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>TQAxBase::setControl ( const&nbsp;<a href="ntqstring.html">TQString</a>&nbsp;&amp; )
</h3><p>Sets the name of the COM object wrapped by this TQAxBase object.
See the <a href="qaxbase.html#control-prop">"control"</a> property for details.
<h3 class=fn>void <a name="setPropertyBag"></a>TQAxBase::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>TQAxBase::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>TQAxBase::signal ( const&nbsp;<a href="ntqstring.html">TQString</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="ntqstring.html">TQString</a> &amp;name, int argc, void *argv )
{
VARIANTARG *params = (VARIANTARG*)argv;
if ( name.<a href="ntqstring.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="ntqstring.html">TQString</a> <a name="control-prop"></a>control</h3>
<p>This property holds the name of the COM object wrapped by this TQAxBase 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">TQt 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>TQt 3.3.8</div>
</table></div></address></body>
</html>