Next Previous Up Top Contents Index

4.6.4 Defining dispatch methods for the dispinterface

4.6.4.2 Dispatch method return value requirements

Dispatch methods must always return an OLE status code as their first value. Return the constant $S-OK when there is no error. You can return a second value from a dispatch method to represent the result of executing the method. More than two result values are not meaningful.

See also "Dispatch method argument and return value types" on page 185.

The following general purpose error codes could be useful as the first return value from a dispatch method:

$E-UNEXPECTED

Unexpected failure.

$E-NOTIMPL

Not implemented.

$E-OUTOFMEMORY

Ran out of memory.

$E-INVALIDARG

One or more arguments are invalid.

$E-POINTER

Invalid pointer.

$E-HANDLE

Invalid handle.

$E-ABORT

Operation aborted.

$E-FAIL

Unspecified error.

$E-ACCESSDENIED

General access denied error.

You can convert a Windows error code, such as returned by the Windows function GetLastError, to a corresponding <SCODE> value with the function HRESULT-FROM-WIN32, page 229.

If <abort> is signalled during execution of the method (or a property getter or setter), a handler in the OLE-Automation library will catch it and return $E-ABORT to the client.


OLE, COM, ActiveX and DBMS Reference - 31 MAR 2000

Next Previous Up Top Contents Index