📄 qaxbase.3qt
字号:
Calls the COM object's method \fIfunction\fR, passing the parameters \fIvar1\fR, \fIvar1\fR, \fIvar2\fR, \fIvar3\fR, \fIvar4\fR, \fIvar5\fR, \fIvar6\fR, \fIvar7\fR and \fIvar8\fR, and returns the value returned by the method, or an invalid QVariant if the method does not return a value or when the function call failed..PPIf \fIfunction\fR is a method of the object the string must be provided as the full prototype, for example as it would be written in a QObject::connect() call..PP.nf.br activeX->dynamicCall( "Navigate(const QString&)", "www.trolltech.com" );.br.fi.PPAlternatively a function can be called passing the parameters embedded in the string, e.g. above function can also be invoked using.PP.nf.br activeX->dynamicCall("Navigate(\\"www.trolltech.com\\");.br.fiAll 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..PPIf \fIfunction\fR is a property the string has to be the name of the property. The property setter is called when \fIvar1\fR is a valid QVariant, otherwise the getter is called..PP.nf.br activeX->dynamicCall( "Value", 5 );.br QString text = activeX->dynamicCall( "Text" ).toString();.br.fiNote that it is faster to get and set properties using QObject::property() and QObject::setProperty()..PPIt is only possible to call functions through dynamicCall() that have parameters or return values of datatypes supported by QVariant. 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 queryInterface() to retrieve the appropriate COM interface, and use the function directly..PP.nf.br IWebBrowser2 *webBrowser = 0;.br activeX->queryInterface( IID_IWebBrowser2, (void**)&webBrowser );.br if ( webBrowser ) {.br webBrowser->Navigate2( pvarURL );.br webBrowser->Release();.br }.br.fi.PPThis is also more efficient..PPExample: qutlook/centralwidget.cpp..SH "QVariant QAxBase::dynamicCall ( const QCString & function, QValueList<QVariant> & vars )"This is an overloaded member function, provided for convenience. It behaves essentially like the above function..PPCalls the COM object's method \fIfunction\fR, passing the parameters in \fIvars\fR, 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 QVariant object..PPThe QVariant objects in \fIvars\fR are updated when the method has out-parameters..SH "void QAxBase::exception ( int code, const QString & source, const QString & desc, const QString & help )\fC [signal]\fR"This signal is emitted when the COM object throws an exception while called using the OLE automation interface IDispatch. \fIcode\fR, \fIsource\fR, \fIdesc\fR and \fIhelp\fR provide information about the exception as provided by the COM server and can be used to provide useful feedback to the end user. \fIhelp\fR includes the help file, and the help context ID in brackets, e.g. "filename [id]"..SH "QString QAxBase::generateDocumentation ()"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 QTextBrowser widget..SH "bool QAxBase::initialize ( IUnknown ** ptr )\fC [virtual protected]\fR"This virtual function is called by setControl() and creates the requested COM object. \fIptr\fR is set to the object's IUnknown implementation. The function returns TRUE if the object initialization succeeded; otherwise the function returns FALSE..PPThe default implementation interprets the string returned by control(), and calls initializeRemote(), initializeLicensed() or initializeActive() 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..PPSee the control property documentation for details about supported patterns..PPThe interface returned in \fIptr\fR 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..SH "bool QAxBase::initializeActive ( IUnknown ** ptr )\fC [protected]\fR"Returns an active instance running on the current machine, and returns the IUnknown interface to the running object in \fIptr\fR. This function returns TRUE if successful, otherwise returns FALSE..PPThis function is called by initialize() if the control string contains the substring "}&"..PPSee also initialize()..SH "bool QAxBase::initializeLicensed ( IUnknown ** ptr )\fC [protected]\fR"Creates an instance of a licensed control, and returns the IUnknown interface to the object in \fIptr\fR. This functions returns TRUE if successful, otherwise returns FALSE..PPThis function is called by initialize() if the control string contains the substring "}:". The license key needs to follow this substring..PPSee also initialize()..SH "bool QAxBase::initializeRemote ( IUnknown ** ptr )\fC [protected]\fR"Creates the instance on a remote server, and returns the IUnknown interface to the object in \fIptr\fR. This function returns TRUE if successful, otherwise returns FALSE..PPThis function is called by initialize() if the control string contains the substring "/{". The information about the remote machine needs to be provided in front of the substring..PPSee also initialize()..SH "bool QAxBase::isNull () const"Returns TRUE if there is no COM object loaded by this wrapper; otherwise return FALSE..PPSee also control..SH "PropertyBag QAxBase::propertyBag () const"Returns a name:value map of all the properties exposed by the COM object..PPThis is more efficient than getting multiple properties individually if the COM object supports property bags..PP\fBWarning:\fR 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..SH "void QAxBase::propertyChanged ( const QString & name )\fC [signal]\fR"If the COM object supports property notification, this signal gets emitted when the property called \fIname\fR is changed..SH "bool QAxBase::propertyWritable ( const char * prop ) const\fC [virtual]\fR"Returns TRUE if the property \fIprop\fR is writable; otherwise returns FALSE. By default, all properties are writable..PP\fBWarning:\fR Depending on the control implementation this setting might be ignored for some properties..PPSee also setPropertyWritable() and propertyChanged()..SH "long QAxBase::queryInterface ( const QUuid & uuid, void ** iface ) const"Requests the interface \fIuuid\fR from the COM object and sets the value of \fIiface\fR to the provided interface, or to 0 if the requested interface could not be provided..PPReturns the result of the QueryInterface implementation of the COM object..PPSee also control..SH "QAxObject * QAxBase::querySubObject ( const QCString & name, const QVariant & var1 = QVariant ( ), const QVariant & var2 = QVariant ( ), const QVariant & var3 = QVariant ( ), const QVariant & var4 = QVariant ( ), const QVariant & var5 = QVariant ( ), const QVariant & var6 = QVariant ( ), const QVariant & var7 = QVariant ( ), const QVariant & var8 = QVariant ( ) )"Returns a pointer to a QAxObject wrapping the COM object provided by the method or property \fIname\fR, passing passing the parameters \fIvar1\fR, \fIvar1\fR, \fIvar2\fR, \fIvar3\fR, \fIvar4\fR, \fIvar5\fR, \fIvar6\fR, \fIvar7\fR and \fIvar8\fR..PPIf \fIname\fR is provided by a method the string must include the full function prototype..PPIf \fIname\fR is a property the string must be the name of the property, and \fIvar1\fR, ... \fIvar8\fR are ignored..PPThe returned QAxObject is a child of this object (which is either of type QAxObject or QAxWidget), 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..PPCOM 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..PP.nf.br QAxWidget outlook( "Outlook.Application" );.br QAxObject *session = outlook.querySubObject( "Session" );.br if ( session ) {.br QAxObject *defFolder = session->querySubObject(.br "GetDefaultFolder(OlDefaultFolders)",.br "olFolderContacts" );.br //....br }.br.fi.PPExample: qutlook/centralwidget.cpp..SH "bool QAxBase::setControl ( const QString & )"Sets the name of the COM object wrapped by this QAxBase object. See the "control" property for details..SH "void QAxBase::setPropertyBag ( const PropertyBag & bag )"Sets the properties of the COM object to the corresponding values in \fIbag\fR..PP\fBWarning:\fR 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..PPSee also propertyBag()..SH "void QAxBase::setPropertyWritable ( const char * prop, bool ok )\fC [virtual]\fR"Sets the property \fIprop\fR to writable if \fIok\fR is TRUE, otherwise sets \fIprop\fR to be read-only. By default, all properties are writable..PP\fBWarning:\fR Depending on the control implementation this setting might be ignored for some properties..PPSee also propertyWritable() and propertyChanged()..SH "void QAxBase::signal ( const QString & name, int argc, void * argv )\fC [signal]\fR"This generic signal gets emitted when the COM object issues the event \fIname\fR. \fIargc\fR is the number of parameters provided by the event (DISPPARAMS.cArgs), and \fIargv\fR 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..PP.nf.br void Receiver::slot( const QString &name, int argc, void *argv ).br {.br VARIANTARG *params = (VARIANTARG*)argv;.br if ( name.startsWith( "BeforeNavigate2(" ) ) {.br IDispatch *pDisp = params[argc-1].pdispVal;.br VARIANTARG URL = *params[argc-2].pvarVal;.br VARIANTARG Flags = *params[argc-3].pvarVal;.br VARIANTARG TargetFrameName = *params[argc-4].pvarVal;.br VARIANTARG PostData = *params[argc-5].pvarVal;.br VARIANTARG Headers = *params[argc-6].pvarVal;.br bool *Cancel = params[argc-7].pboolVal;.br }.br }.br.fi.PPUse this signal if the event has parameters of unsupported data types. Otherwise, connect directly to the signal \fIname\fR..SS "Property Documentation".SH "QString control"This property holds the name of the COM object wrapped by this QAxBase object..PPSetting this property initilializes the COM object. Any COM object previously set is shut down..PPThe most efficient way to set this property is by using the registered component's UUID, e.g..PP.nf.br ctrl->setControl( "{8E27C92B-1264-101C-8A2F-040224009C02}" );.br.fiThe second fastest way is to use the registered control's class name (with or without version number), e.g..PP.nf.br ctrl->setControl( "MSCal.Calendar" );.br.fiThe slowest, but easiest way to use is to use the control's full name, e.g..PP.nf.br ctrl->setControl( "Calendar Control 9.0" );.br.fi.PPIf 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:.TPTo initialize the control on a different machine use the following pattern:.IP.nf.br <domain/username>:<password>@server/{8E27C92B-1264-101C-8A2F-040224009C02}.br.fi.TPTo initialize a licensed control use the following pattern:.IP.nf.br {8E27C92B-1264-101C-8A2F-040224009C02}:<LicenseKey>.br.fi.TPTo connect to an already running object use the following pattern:.IP.nf.br {8E27C92B-1264-101C-8A2F-040224009C02}&.br.fiThe first two patterns can be combined, e.g. to initialize a licensed control on a remote machine:.PP.nf.br ctrl->setControl("DOMAIN/user:password@server/{8E27C92B-1264-101C-8A2F-040224009C02}:LicenseKey");.br.fi.PPThe 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..PPSet this property's value with setControl() and get this property's value with control()..SH "SEE ALSO".BR http://doc.trolltech.com/qaxbase.html.BR http://www.trolltech.com/faq/tech.html.SH COPYRIGHTCopyright 1992-2001 Trolltech AS, http://www.trolltech.com. See thelicense file included in the distribution for a complete licensestatement..SH AUTHORGenerated automatically from the source code..SH BUGSIf you find a bug in Qt, please report it as described in.BR http://doc.trolltech.com/bughowto.html .Good bug reports help us to help you. Thank you..PThe definitive Qt documentation is provided in HTML format; it islocated at $QTDIR/doc/html and can be read using Qt Assistant or witha web browser. This man page is provided as a convenience for thoseusers who prefer man pages, although this format is not officiallysupported by Trolltech. .PIf you find errors in this manual page, please report them to.BR qt-bugs@trolltech.com .Please include the name of the manual page (qaxbase.3qt) and the Qtversion (3.3.5).
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -