beautypg.com

HP NonStop G-Series User Manual

Page 104

background image

Returning Error Messages

Extending the Tandem DDE Gateway

8–2

110838 Tandem Computers Incorporated

Returning Error

Messages

You can return errors to the Tandem DDE Gateway from RSC logon functions and
User Hook Library functions. When there is no error, return a non-zero value from the
function.

You can return an error to the Tandem DDE Gateway, which will then display the
error message and, for User Hook Library functions, return a DDE “not processed”
error to your client application. Your client application can subsequently retrieve the
error information and display it, thus enabling you to return error information from
your User Hook Library to your client application.

To return an error, return a zero value for the function and fill out the elements of the
tagTdmgwErrorMsg structure (defined in TDMGW.H).

The tagTdmgwErrorMsg structure is defined as follows:

/* Defines for values of cErrorType */

#define TDMGW_MESSAGE_NONE 'N'

#define TDMGW_MESSAGE_NO_FLASH_ICON 'I'

#define TDMGW_MESSAGE_FLASH_ICON 'F'

/* Defines for lengths of strings */

#define TDMGW_MAX_SUBSYS_STRLEN 8

#define TDMGW_MAX_ERROR_TEXT_STRLEN 512

struct tagTdmgwErrorMsg {

char szSubSys[TDMGW_MAX_SUBSYS_STRLEN+1];

unsigned int uErrorNum;

char cErrorType;

char szErrorText[TDMGW_MAX_ERROR_TEXT_STRLEN+1];

};

Follow these steps to return an error from a function:

1.

Return a value of zero from the function.

2.

Set szSubSys of the error structure to a null-terminated string identifying the
component of the Tandem DDE Gateway that is returning the error (usually
RSCLOGON or USERHOOK). However, you can set szSubSys to whatever
readable null-terminated string that you would like to use to identify the error to
the application user.

3.

Set uErrorNum of the error structure to an error number that you define.

4.

Set cErrorType of the error structure to either TDMGW_MESSAGE_FLASH_ICON
(to beep and flash the Tandem DDE Gateway icon) or
TDMGW_MESSAGE_NO_FLASH_ICON (which will also not beep). If you use
the second option, your client application should retrieve the error information
and display it (see the topic “Error Handling” in Section 4, “Creating Client
Applications”).

Compiling, Linking, and

Debugging

Constants, structures, and function prototypes used to extend the Tandem DDE
Gateway are defined in the TDMGW.H file in the EXTEND\ subdirectory.