CALLOBJECTMETHOD

Top  Previous  Next

Syntax

INT = CallObjectMethod(IDispatch obj,STRING member,...)

Description

Calls a method of a COM object using script syntax.

Parameters

obj - The Object returned by the CREATECOMOBJECT command.
member - The name of the method to call.
... - Optional parameter list.

Return value

0 for Success.

Remarks

Parameters to a method are specified by using C printf-like specifiers.  The table below shows the supported specifiers:

 

Identifier

Type

%d

INT

%u

UINT

%e

DOUBLE

%b

INT

%v

VARIANT UDT.

%B

BSTR - Created with the AllocSysString API function

%s

STRING

%S

WSTRING

%T

WSTRING

%o

IDispatch COM object

%O

IUnknown COM object

%t

C time_t UDT

%W

SYSTEMTIME UDT

%f

FILETIME UDT

%D

C date type.

%p

POINTER

%m

Specifies a missing/optional argument

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()