Purpose |
Return the result of the execution of the most recent OBJECT statement. | ||||||||||||||||||||||||
Syntax |
lResult& = OBJRESULT | ||||||||||||||||||||||||
Remarks |
If an OBJECT statement fails at run-time, the ERR system variable is set to an appropriate PowerBASIC error code. This is usually Error 5 ("Illegal function call"). In such cases, you can use the OBJRESULT function to return the result (lResult&) of the last run-time OBJECT statement. Numeric equates for most OBJRESULT errors can be found in the WIN32API.INC file, and are mostly prefixed with %E_, %CO_ and %OLE_. The following list comprises a selection of the most common errors that may be encountered:
As can be seen from the above error list, a large numeric error code can be cryptic. However, we can translate the OBJRESULT error code into a verbose error message using the FormatMessage API function. This can be most helpful especially during application development and debugging. | ||||||||||||||||||||||||
See also |
DIM, CLSID$, GUID$, GUIDTXT$, INTERFACE/END INTERFACE, ISNOTHING, ISOBJECT, OBJECT, OBJACTIVE, OBJPTR, PROGID$, SET | ||||||||||||||||||||||||
Example |
' Uses MAKELANGID() function in WIN32API.INC DIM A AS ASCIIZ * 1024 CALL FormatMessage(%FORMAT_MESSAGE_FROM_SYSTEM, _ BYVAL 0&, OBJRESULT, BYVAL MAKELANGID( _ %LANG_NEUTRAL, %SUBLANG_DEFAULT), _ A, SIZEOF(A), BYVAL 0&) ' A will contain a verbose system error message |