MsgState
Verifies the status of a message session. Use MsgState() to check the return value of MsgOpen(). A message post function is set effectively only if MsgState() returns 1, which means the message session is online.
Syntax
MsgState(hMsg)
hMsg:
The message handle, returned from the MsgOpen() function. The message handle identifies the table where all data on the associated message is stored.
Return Value
This function has the following possible return values:
Related Functions
Example
INT hClient = -1;
// Open message session on the client, connecting using the existing
// message session to the current Alarm server
FUNCTION
MsgClientOpen()
INT nState;
hClient = MsgOpen("Alarm", 0, MsgPostClient);
IF hClient <> -1 THEN
nState = MsgState(hClient);
SELECT CASE nState
CASE 1
Prompt("Message session is online!");
//Send a message to the server
MsgWrite(hClient, 1, "MyMessage");
CASE -1
Prompt("Message session handle is invalid!");
CASE 0
Prompt("Message session is offline!");
CASE 2
Prompt("Message session is connecting!");
CASE 3
Prompt("Message session is disconnecting!");
CASE ELSE
Prompt("Message session has unknown status!");
END SELECT
ELSE
Prompt("Message session could not be opened!");
END
END
See Also