xxxFormatMessage

Formats a command or event generated by a service managed by this service manager.

Prototype

DWORD xxxFormatMessage (DISP_MESSAGE *pmsg, char *msgtext, unsigned size, char *indent)

Argument

Description

pmsg

Pointer to the DISP_MESSAGE structure:

typedef struct
{
 DWORD id;          /* Event code (and source service ID ) */
 DWORD ctahd;       /* Natural Accesso context handle      */
 DWORD specific[6]; /* Fields specific to events/command   */
 DWORD reserved;    /* Must be zero (0).                   */
 MESSAGE_ADDR addr; /* Source/destination service ID       */
} DISP_MESSAGE;

typedef struct
{
 WORD source        /* source service ID                   */
 WORD destination   /* destination service ID              */
} MESSAGE_ADDR;

msgtext

Pointer to a character string to receive the formatted message.

size

Size of msgtext.

indent

Pointer to a character string to be placed at the beginning of each newly formatted line.


Return values

SUCCESS

Details

xxxFormatMessage formats a dispatcher command or event into a user-readable text format. The DISP_MESSAGE structure contains the fields necessary to determine whether the message is a command or an event. Once this is known, the function can cast the pointer to the appropriate DISP_COMMAND or DISP_EVENT structure and format it appropriately.

msgtext is passed in by the dispatcher and its size should be checked so that the service only copies as much text as can fit into the string without overwriting the end and causing a protection violation. Typically, services format their messages into an internal buffer big enough to hold the text of any message produced by the service. It then copies as much as it can to msgtext.

indent should be prepended to the beginning of each new text line by the formatting routine. This gives the application some control over how events are printed if this function is called from ctaFormatEvent.

For more information about this function, refer to Runtime binding functions.

See also

xxxGetText