[Next] [Previous] [Up] [Top] [Contents] [Index]

2.1 DCOD Calling Structure

2.1.1 Message Utility

It is common for dialogs to use the PSYX message system as a way of reading flags to modify the dialog's behavior. However, when combinations of modifiers are used in string message IDs, it can become unwieldy to assign each possible string message ID a unique four-character message ID.

To solve this problem, a pair of message utilities are available to PSYXs:

	void SaveMessageAndMakeCode(GetMsgCodeStruct *msgData, long id);
	int LoadMessageString(long msg, long id, char *buffer);

These functions are generally used in the following way:

When a pGetMsgCode message is received, SaveMessageAndMakeCode() is called, passing in the DCOD's ID as the second parameter. This function reads and appropriately modifies the GetMsgCodeStruct structure, inventing a new four-character message ID for the string (or using a message ID generated previously, if the string has been passed to this DCOD before).

When the DCOD later receives a message ID that it does not recognize, it calls LoadMessageString(). If the message ID is one that was invented by SaveMessageAndMakeCode(), LoadMessageString() puts the original message string (up to 256 bytes) into the buffer parameter and returns TRUE. If LoadMessageString() returns FALSE, the DCOD should not attempt to respond to the message.

PSYX Programmer's Manual - 24 AUG 95
[Next] [Previous] [Up] [Top] [Contents] [Index]

Generated with CERN WebMaker