<< Click to Display Table of Contents >>
ZfxSendMsgEx
Submit message to fax server for sending.
Syntax
ZFERR FAR ZfxSendMsgEx( ZFSESSIONHANDLE hSession, char FAR *lpszDataExtn, short MsgInfoExSize, ZFMSGINFOEX lpMsgInfoEx)
Parameters
Parameter |
Description |
hSession |
API session handle, as returned by ZfxAPIInit call |
lpszDataExtn |
Extension of data file corresponding to the data format |
MsgInfoExSize |
Size of the ZFMSGINFOEX structure, as returned by sizeof(ZFMSGINFOEX). |
lpMsgInfoEx |
Address of a single ZFMSGINFOEX structure, containing the body, comment and subject of the message to be submitted. |
Description
This routine makes an entry for a new message in the user's OUT directory INFO file then sends a message to the Zetafax server asking it to queue the message for sending.
The caller should first create two files in the users OUT directory (as given by the ZfxGetUserOutDir function). These are the control file (with extension ".CTL"), and the data file (with an extension corresponding to the data file format, as specified in File System Structure section above. The two files should have the same body name, which will usually have been determined by calling the ZfxCreateAutoFileroutine.
Note that once a message has been submitted to the fax server for processing, the server will periodically open the control file to change the status lines or append message history and status information to the file. It is recommended that application programs avoid opening the control file until the status of the message changes to ZFMSG_OK or ZFMSG_FAILED, at which point the server has completed processing of the message. However, if the program requires to read the file during this time then it must not be kept open for more than 2 seconds, otherwise status updates may be lost.
Return value
The routine returns 0 if successful, otherwise one of the following:
ZFERR_NOT_INITIALISED
ZFERR_INVALID_PARAMETERS
ZFERR_SERVER_NOT_RUNNING
ZFERR_FILE_NOT_FOUND
ZFERR_MESSAGE_ALREADY_EXISTS
ZFERR_INFO_FILE_OPEN_ERROR
ZFERR_INFO_FILE_ERROR
ZFERR_INFO_FILE_INVALID
ZFERR_CANNOT_SUBMIT_REQUEST
Example
#include <stdio.h>
#include <zfapi.h>
...
ZFMSGINFOEX MsgInfo;
...
/* create ~XSND000.CTL and ~XSND000.TXT */
...
if (ZfxSendMsgEx(hSession, "TXT", sizeof(ZFMSGINFOEX), &MsgInfo) == 0)
{
f("Submitted to Zetafax server\n");}
else
{
/* delete the two files */
...
}
Related topics