JavaScript Editor js editor     Web development 

Main Page

Creates an instance of a registered COM object (such as a Visual FoxPro Automation server) on a remote computer.




Specifies the CLSID (Class Identifier) or PROGID (Programmatic Identifier) for the COM object to instantiate. If you include a CLSID, the COM object must be registered on the remote server you specify with cComputerName. If you include a PROGID, the COM object must be registered on both the your local computer and the remote computer you specify with cComputerName. Attempting to use a PROGID without first registering the server on your local computer will generate the OLE error Code 0x800401f3, "Invalid Class String." For Visual FoxPro automation servers created on your local machine, you can use the server object CLSID and PROGID properties to determine the local CLSID and PROGID values.

Specifies the remote computer on which the COM object is instantiated. If cComputerName is the empty string, the COM object is instantiated on the local computer or a redirected machine as specified in the registry. cComputerName supports Universal Naming Convention (UNC) names such as "\\myserver" and "myserver," and Domain System Names (DNS) names.

Specifies the Interface ID GUID of cCLSID | cPROGID when you create an early bound instance of the class. If you pass an empty string as cIID Visual FoxPro attempts to access the default interface (IID) of cCLSID | cPROGID.

Return Value



В Copy Code
      x = CREATEOBJECTEX("excel.application","",;
The following is a valid function call for an excel application object. It will return the excel.application default interface.

В Copy Code
      x = CREATEOBJECTEX("excel.application","","")


CREATEOBJECTEX( ) returns an object reference to the COM object if it is successfully instantiated. CREATEOBJECTEX( ) cannot be used to instantiate Visual FoxPro classes such as forms – use CREATEOBJECT( ) to instantiate Visual FoxPro classes. Note that you can only abbreviate CREATEOBJECTEX( ) to a minimum of 13 characters, distinguishing it from the CREATEOBJECT( ) function.

When you call certain COM classes with CREATEOBJECT(В ) they return "No such interface supported" because they do not support an IDispatch interface. Using the cIID parameter you can now access these classes in your applications.

If you pass an empty string ("") as cIID Visual FoxPro attempts to to get the default interface (IID) of the specified CLSID or PROGID.

Because it supports early binding through cIID, CREATEOBJECTEX(В ) can help improve performance by avoiding much of the overhead of IDispatch calls.

CREATEOBJECTEX(В ) supports creation of new early-bound objects. However, it is also possible that your Visual FoxPro component is passed an object that you want to call via early-binding. You can use the GETINTERFACE(В ) support on existing COM objects.

For additional information about using Visual FoxPro to create Automation servers, see Sharing Information and Adding OLE.

See Also

JavaScript Editor js editor     Web development