CREATEOBJECTEX( ) Function

See Also

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

Syntax

CREATEOBJECTEX(cCLSID | cPROGID, cComputerName)

Returns

Object

Arguments

cCLSID | cPROGID

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.

cComputerName

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. Use Clireg32.exe or Racmgr32.exe to redirect the local machine to another machine through the registry.

cComputerName supports UNC (Universal Naming Convention) names such as “\\myserver” and “myserver,” and DNS (Domain Name System) names such as “myserver.com,” “www.microsoft.com,” and “207.68.137.56.”

Remarks

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.

CREATEOBJECTEX( ) requires Windows NT 4.0 or later, or Windows 95 with DCOM95 installed.

For additional information about using Visual FoxPro to create Automation servers, see Chapter 16, Adding OLE, in the Programmer's Guide.