Translate page

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)




QWS3270 Automation copyright © Jolly Giant Software Inc. All rights reserved.