<!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/doc/container.doc:1 --> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> <title>The TQAxContainer Module</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 Classes</font></a> | <a href="mainclasses.html"> <font color="#004faf">Main Classes</font></a> | <a href="annotated.html"> <font color="#004faf">Annotated</font></a> | <a href="groups.html"> <font color="#004faf">Grouped Classes</font></a> | <a href="functions.html"> <font color="#004faf">Functions</font></a> </td> <td align="right" valign="center"><img src="logo32.png" align="right" width="64" height="32" border="0"></td></tr></table><h1 align=center>The TQAxContainer Module</h1> <p> <p> <!-- toc --> <ul> <li><a href="#1"> Introduction </a> <li><a href="#2"> Building the library </a> <li><a href="#3"> Using the library </a> <ul> <li><a href="#3-1"> Distributing TQAxContainer applications </a> </ul> <li><a href="#4"> Instantiating COM objects </a> <li><a href="#5"> Accessing the object API </a> <ul> <li><a href="#5-1"> Typical error messages </a> <ul> <li><a href="#5-1-1"> Requested control could not be instantiated </a> <li><a href="#5-1-2"> TQAxBase::internalInvoke: No such method </a> <li><a href="#5-1-3"> Error calling IDispatch member: Non-optional parameter missing </a> <li><a href="#5-1-4"> Error calling IDispatch member: Type mismatch in parameter n </a> <li><a href="#5-1-5"> TQAxScriptManager::call(): No script provides this function </a> </ul> </ul> </ul> <!-- endtoc --> <p> <h2> Introduction </h2> <a name="1"></a><p> The TQAxContainer module provides a library implementing a <a href="ntqwidget.html">TQWidget</a> subclass, <a href="qaxwidget.html">TQAxWidget</a>, that acts as a container for ActiveX controls, and a <a href="ntqobject.html">TQObject</a> subclass, <a href="qaxobject.html">TQAxObject</a>, that can be used to easily access non-visual COM objects. Scripting COM objects embedded using these classes is possible through the <a href="qaxscript.html">TQAxScript</a>, <a href="qaxscriptmanager.html">TQAxScriptManager</a> and <a href="qaxscriptengine.html">TQAxScriptEngine</a> classes. <p> This module is part of the <a href="activentqt.html">ActiveTQt framework</a>. (To make an application into an ActiveX server see the <a href="qaxserver.html">TQAxServer module</a>.) <p> The module consists of six classes <ol type=1> <li> <a href="qaxbase.html">TQAxBase</a> is an abstract class that provides an API to initialize and access a COM/ActiveX object. <li> <a href="qaxobject.html">TQAxObject</a> provides a TQObject that wraps a COM object. <li> <a href="qaxwidget.html">TQAxWidget</a> is a <a href="ntqwidget.html">TQWidget</a> that wraps an ActiveX control. <li> <a href="qaxscriptmanager.html">TQAxScriptManager</a>, TQAxScript and TQAxScriptEngine provide an interface to the Windows Script Host. </ol> <p> Some <a href="qaxcontainer-examples.html">example applications</a> that use standard ActiveX controls to provide high level user interface functionality are provided. <p> <h2> Building the library </h2> <a name="2"></a><p> In the <tt>activeqt</tt> directory (usually <tt>QTDIR/extensions/activeqt</tt>) enter the <tt>container</tt> subdirectory and run <tt>qmake</tt> to generate the makefile, and use the make tool (<tt>nmake</tt> for VC++, <tt>make</tt> for Borland) to build the library. The library <tt>qaxcontainer.lib</tt> will be linked into <tt>QTDIR/lib</tt>. <p> If you have a shared configuration of TQt enter the <tt>plugin</tt> subdirectory and run <tt>qmake</tt> and your make tool to build a plugin that integrates the <a href="qaxwidget.html">TQAxWidget</a> class into <a href="designer-manual.html">TQt Designer</a>. <p> <h2> Using the library </h2> <a name="3"></a><p> To build TQt applications that can host COM objects and ActiveX controls link the application against the TQAxContainer module by adding <p> <pre> LIBS += qaxcontainer.lib </pre> <p> to the application's <tt>.pro</tt> file. <p> <h3> Distributing TQAxContainer applications </h3> <a name="3-1"></a><p> The TQAxContainer library is static, so there is no need to redistribute any additional files when using this module. Note however that the ActiveX server binaries you are using might not be installed on the target system, so you have to ship them with your package and register them during the installation process of your application. <p> <h2> Instantiating COM objects </h2> <a name="4"></a><p> To instantiate a COM object use the <a href="qaxbase.html#setControl">TQAxBase::setControl</a>() API, or pass the name of the object directly into the constructor of the <a href="qaxbase.html">TQAxBase</a> subclass you are using. <p> The control can be specified in a variety of formats, but the fastest and most powerful format is to use the class ID (CLSID) of the object directly. The class ID can be prepended with information about a remote machine that the object should run on, and can include a license key for licensed controls. <p> <h2> Accessing the object API </h2> <a name="5"></a><p> <a href="activentqt.html#ActiveTQt">ActiveTQt</a> provides a TQt API to the COM object, and replaces COM datatypes with TQt equivalents. Use the <tt>dumpdoc</tt> tool to get the documentation of the TQt API for any COM object and it's subobjects. <p> See the <a href="qaxwidget.html">TQAxWidget</a> and <a href="qaxobject.html">TQAxObject</a> API documentation about how to use this class to use ActiveX controls and COM objects in TQt applications. To access the COM object with scripting languages use the <a href="qaxscript.html">TQAxScript</a> class. <p> To call functions of the COM object that can not be accessed via ActiveTQt it is possible to request the COM interface directly using <a href="qaxbase.html#queryInterface">TQAxBase::queryInterface</a>(). To get a C++ definition of the respective interface classes use the <tt>#import</tt> directive with the type library provided with the control. <p> <h3> Typical error messages </h3> <a name="5-1"></a><p> ActiveTQt prints error messages to the debug output when it encounters error situations at runtime. Usually you must run your program in the debugger to see these messages (e.g. in Visual Studio's Debug output). <p> <h4> Requested control could not be instantiated </h4> <a name="5-1-1"></a><p> The control requested in <a href="qaxbase.html#setControl">TQAxBase::setControl</a>() is not installed on this system, or is not accessible for the current user. <p> The control might require administrator rights, or a license key. If the control is licensed, reimplement initialize() and use the COM APIs to call the IClassFactory2 interface functions. <p> <h4> TQAxBase::internalInvoke: No such method </h4> <a name="5-1-2"></a><p> A <tt>dynamicCall()</tt> failed - the function prototype did not match any function available in the object's API. <p> <h4> Error calling IDispatch member: Non-optional parameter missing </h4> <a name="5-1-3"></a><p> A <tt>dynamicCall()</tt> failed - the function prototype was correct, but too few parameters were provided. <p> <h4> Error calling IDispatch member: Type mismatch in parameter n </h4> <a name="5-1-4"></a><p> A <tt>dynamicCall()</tt> failed - the function prototype was correct, but the paramter at index <tt>n</tt> was of the wrong type and could not be coerced to the correct type. <p> <h4> <a href="qaxscriptmanager.html#call">TQAxScriptManager::call</a>(): No script provides this function </h4> <a name="5-1-5"></a><p> You try to call a function that is provided through an engine that doesn't provide introspection (ie. ActivePython or ActivePerl). You need to call the function directly on the respective <a href="qaxscript.html">TQAxScript</a> object. <!-- eof --> <p><address><hr><div align=center> <table width=100% cellspacing=0 border=0><tr> <td>Copyright © 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>