Function ComLastError() Foundation

Returns error code after calling GetObject() or CreateObject()

Syntax
ComLastError() --> nError
Return

A numeric error value indicating the code of the error that occured in the functions GetObject() or CreateObject(). If zero is returned, no error occured.

Description

The function ComLastError() can be used to obtain the error code after the function GetObject() or CreateObject() is called.

The error condition of the Xbase++ COM/ActiveX layer is thread local.

Examples
Get error value
#pragma Library( "ascom10.lib" ) 
PROCEDURE Main 
  oApp := CreateObject( "NoExisting.Application.4" ) 

  ? "Error: ", ComLastError() 
  ? "Description:" 
  ? ComLastMessage() 

RETURN 
Feedback

If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.