Method AutomationObject():create() Foundation

Creates and connects to a COM/ActiveX object

:create( <cProgID> | <cCLSID> | <nInterface>, [<cServerName>], ;
        [<cLicense>] ) --> oAutomationObject | NIL
<cProgID> is the ProgID identifying the COM/ActiveX object to be created.
A ProgID has the following syntax:
Thereby specification of (.Version) is optional. It defaults to the highest version number installed on the system if omitted.
The ProgIDs of the COM/ActiveX components installed on a computer are listed in the registry at the key HKEY_CLASSES_ROOT.
<cCLSID> is the class ID that can be used as an alternative to <cProgID>. Class IDs are stored in the registry as subkeys of a ProgID.
<nInterface> is the numeric value of a COM interface. This parameter allows the creation of AutomationObjects with interface pointers obtained from operating system API calls or from other modules developed with system languages like C/C++.
By default, the COM/ActiveX component is created on the machine where the application runs. If a server name is passed in <cServerName>, the COM/ActiveX object is created on the remote machine named cServerName instead. Access to methods and/or properties are automatically routed to the remote COM/ActiveX component.
If <cServerName> is passed, care must be taken regarding access rights. The method :create() fails if the required access rights are not granted by the remote computer.
Some COM/ActiveX components require a license key for being created. If a license key is required, it should be specified in the documentation that accompanies the COM/ActiveX component.
If a license key is required to create a COM/ActiveX component, <cLicense> becomes a mandatory parameter. The method :create()fails if the license key is omitted or if it is incorrect.

This method returns an object of the class AutomationObject that is connected to a COM/ActiveX object. If the method fails, the value NIL is returned. In this case, the corresponding error number and a descriptive error message can be retrieved by calling the functions ComLastError() and ComLastMessage().


The AutomationObject instance returned by the method :create() is connected to the COM/ActiveX component specified in the method's parameters. The AutomationObject instance serves as a proxy that allows the Xbase++ application to call methods or to access properties of the COM/ActiveX component.


If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.