Return Values
For all methods, the return value for non-scripting languages will be HRESULT. Languages like Visual Basic/VBA will see the ‘status’ variable as the return code.  A function defined as:
HRESULT func(long *first, int *second, long *retVal)
will return an HRESULT to COM. Â For VB the function definition will look like this:
Function func(first as Long, second as Integer) as Long
The return value in this case will be 'Long'.
If an error occurs, you can examine the HRESULT which is the error code displayed by Visual Basic. It's value can be divided into 3 parts:
severity
The severity part indicates the type of result, e.g. error, information, etc. The severity will always be 1 (SEVERITY_ERROR) for internal errors.
facility
The facility indicates which part of the system discovered the error. In the case of COM objects it will always be either FACILITY_ITF (InTerFace) which indicates an error returned by QWS3270 Automation, or FACILITY_WIN32 which will indicate an error reported by the Win32 API to QWS3270 Automation.
code
The code portion will contain the actual error information if an error occurred. To extract the code from the HRESULT you can use the following macro:
#define HRESULT_CODE(hr) ((hr) & 0xFFFF)