Version









Figure 4. Polling the Remote Receiver (one page document)

Figure 5. Responding to the Remote Transmitter's Poll (one page document)









|
Trace Mask
|
Description
|
|---|---|
|
0x000C00
|
Logs information relating to T.30 protocol.
|
|
0x000F00
|
Logs all available fax information.
|



void SendFaxDocAndWait( HCALL hCall, LPCTSTR szFileName,
FAX_DOC_PARMS *fparms, FAX_TRANSMIT_PARMS *tparms )
{
UINT uDeviceID;
HFAX hFax;
FAX_QUEUE_HANDLE hQueue;
HANDLE hFaxEvent;
FAXMESSAGE fmsg;
/* Get handle for the fax device */
faxGetID( hCall, &uDeviceID );
/* Open the fax device */
faxOpen( &hFax, uDeviceID, (DWORD) &hFaxEvent, (DWORD) 0, \
FXO_EVENT );
/* create a transmit queue, enqueue a document, and fax it. */
faxCreateQueue( hFax, FAX_DOC_TRANSMIT, &hQueue );
faxEnqueueDoc( hFax, hQueue, szFileName, fparms, &dwDocNumber );
faxSendFax( hFax, hQueue, tparms, 0, 0 );
/* Wait for the fax to be sent */
do
{
DWORD dwEvent = WaitForSingleObject( hFaxEvent, INFINITE );
if ( dwEvent != WAIT_OBJECT_0 )
break;
faxGetMessage( hFax, &fmsg );
}
while( fmsg.hQueue != hQueue || fmsg.dwMsg != FAXMSG_SESSION_COMPLETED )
/* When the fax is done, destroy the queue and release the handle */
faxDestroyQueue( hFax, hQueue );
faxClose( hFax );
}

void ReceiveFaxDocAndWait( HCALL hCall, LPCSTR szFileName, FAX_DOC_PARMS* fparms, FAX_RECEIVE_PARMS* rparms )
{
UINT uDeviceID;
HFAX hFax;
FAX_QUEUE_HANDLE hQueue;
HANDLE hFaxEvent;
FAXMESSAGE fmsg;
/* Get a handle to the fax device */
faxGetID( hCall, &uDeviceID );
/* Open fax device */
faxOpen( &hFax, uDeviceID, (DWORD) &hFaxEvent, (DWORD) 0, FXO_EVENT );
/* Create receiving queue, add document filename to the queue, and start receiving */
faxCreateQueue( hFax, FAX_DOC_RECEIVE, &hQueue );
faxEnqueueDoc( hFax, hQueue, szFileName, fparms, &dwDocNumber );
faxReceiveFax( hFax, hQueue, rparms, 0, 0 );
/* wait for the completion */
do
{
DWORD dwEvent = WaitForSingleObject( hFaxEvent, INFINITE );
if ( dwEvent != WAIT_OBJECT_0 )
break;
faxGetMessage( hFax, &fmsg );
}
while ( ! ( fmsg.hQueue == hQueue && fmsg.dwMsg == FAXMSG_SESSION_COMPLETED );
/* Destroy the queue and release the handle */
faxDestroyQueue( hFax, hQueue );
faxClose( hFax );
}
Version