CREATECOMOBJECT

Top  Previous  Next

Syntax

COMREF = CREATECOMOBJECT (name as STRING, machine as STRING)

Description

Creates a COM object using script syntax.

Parameters

name - name of the object to create.
machine - UNC of a remote machine.

Return value

Returns the COM object if successful, NULL otherwise.

Remarks

COM objects that run in their own process, such as Word and Excel can be created on a remote computer, assuming you have access rights.

Example usage

IDispatch Connection
POINTER szResponse
INT _status
Connection = CreateComObject("MSXML2.XMLHTTP.3.0", "")
CallObjectMethod(Connection, ".Open(%s, %s, %b)", "GET", "http://myserver.com/test.xml", FALSE)
CallObjectMethod(Connection, ".Send")
GetComProperty(Connection, "%d", &_status, ".status")
if _status = 200
       GetComProperty(Connection, "%T", &_szResponse, ".ResponseXML.xml")
       PRINT w2s(*<wstring>_szResponse)
       FreeComString(_szResponse)
endif
Connection->Release()