<< Click to Display Table of Contents >>
ZfxCheckNewMsgStatus
Check if message status has changed.
Syntax
ZFERR FAR ZfxCheckNewMsgStatus( ZFSESSIONHANDLE hSession, ZFMSGDIR MsgDir, short FAR *lpfStatusChanged)
Parameters
Parameter |
Description |
hSession |
API session handle, as returned by ZfxAPIInit call MsgDirMessage type - ZFDIR_OUT for sent messages, or ZFDIR_IN for received messages |
lpfStatus |
Changed Address of short integer boolean variable which is set to a non-zero value if the status of one or more messages may have changed since the last call to this function, 0 otherwise 1. |
Description
This routine checks whether the status of any of the messages in the current users OUT or IN directory (depending on the setting of MsgDir) has changed. If the fStatusChanged variable is set (non-zero) on return then the calling program should call the ZfxGetMsgInfoEx routine for each message it is interested in (or the ZfxGetMsgListExto get information for all messages) to identify what (if anything) has changed.
This function is supplied because ZfxGetMsgInfoEx and ZfxGetMsgListEx stop the server updating the status of any messages for that user while running, and should therefore only be called when necessary. The ZfxCheckNewMsgStatus function acts by checking the attributes of a file, and therefore it is recommended that it is not called more frequently than every 5 to 10 seconds unless a quicker response is required.
Return value
The routine returns 0 if successful, otherwise one of the following:
ZFERR_NOT_INITIALISED
ZFERR_INFO_FILE_ERROR
Example
#include <stdio.h>
#include <zfapi.h>
...
for (;;)
{
if (ZfxCheckNewMsgStatus(hSession, ZFDIR_OUT, &fChanged) == 0 && fChanged)
{
/* call ZfxGetMsgListEx */
...
}
/* sleep for a few seconds */
}
Related topics