SetupFaxDriver

#include ”faxcpp.h”

int far SetupFaxDriver(LPSTR FaxMangerDLLName)

Class 1.

Class 2.

Class 2.0

Brooktrout

 

GammaLink

 

Dialogic

 

NMS

 

g

g

g

g

g

g

Description

Initializes the fax driver by passing the FAX MANAGER DLL name to the driver. If the Manager DLL name is incorrect or NULL, the driver will use default settings and subsequent calls will be ignored until the driver is closed. To change the Manager DLL name at run-time, the function EndOfFaxDriver(TRUE); must be called to close the driver. The SetupFaxDriver() should be the first call of this function set.

 

The SetupFaxDriver () initializes the fax drivers, so this must be the first call of this function set.   When a fax event occurs in the system it will be sent to the FaxEventHandler (export number - 4 in the Manager DLL) function. WARNING: the given event handler routine MUST be in a DLL.

Syntax of callback function:

 

long CALLBACK ProcEvent(void *This, TEFaxEvent Event, LPARAM lParam)

 

where the data type of  *This parameter depends on the Event parameters. In most cases it is PORTFAX type but in the case of FEV_QUEUE_IN or FEV_QUEUE_OUT Event then it is TCQueue far * type.

TEFaxEvent specifies the type of the event, which can be:

 

FEV_STARTDRV                 The driver has started. The pSendQueue, pReceiveQueue and pErrorQueue queues must be created. This parameter contains the DIALOGBOX HWND handle and the lParam parameters are set to NULL.

FEV_ENDDRV                     The driver has stopped. The created queues must be deleted. This and lParam parameters are set to NULL.

FEV_ENABLETASKS          Indicates when the other windows tasks are enabled. The This parameter holds the window handle of the DIALOGBOX The lParam is set to TRUE when other windows tasks are enabled and FALSE when disabled.

FEV_BEGINPORT               This is NOT a message!  Use this to determine the This parameter value. If the event type value is greater than FEV_BEGINPORT then This is a FAXPORT data type.

FEV_CONNECT                   Indicates when the given port is connected or disconnected. lParam is TRUE for connect and FALSE for disconnect.

FEV_RING                            Ring is detected. The lParam contains the number of rings.

FEV_DIAL                             The port starts to dial.  lParam is NULL.

FEV_ANSWER                     The given port is answering a call. lParam is NULL.

FEV_STARTSEND               Start sending a fax on the given port. lParam contains the fax count of the current session.

FEV_STARTRECEIVE        The given port starts receiving a fax.  The LOWORD of lParam is the fax receive count and the HIWORD of the lParam is the fax type.

FEV_ENDSEND                   Sending of the fax is completed.  lParam contains the address of the fax object sent.

FEV_ENDRECEIVE             Receiving of a fax is completed.  lParam contains the address of the fax object received FAXOBJ data type.

FEV_RECREMOTEID        Indicates that the driver received the transmitted fax ID.  Usually, it is the transmitting fax number.  This is stored in the 1Param.  If the returned value is not NULL, the driver will disconnect.

FEV_STARTPAGE               Beginning of send or receive of a page in a fax transmission. LOWORD of lParam is the page number of the current fax. The HIWORD of the lParam is TRUE on send and FALSE on receive.

FEV_ENDPAGE                    End of send or receive of a page in a fax transmission. LOWORD of lParam is the page number of the current fax. The HIWORD of the lParam is TRUE on send and FALSE on receive.

FEV_ERROR                        An error has occurred. The lParam is FAXERROR data type and contains the address of the error object.

FEV_ABORTFAX                 External abort is detected. The lParam contains the value of the break flag. The break flag interpretation is the same as the AbortPort() function.  Break is BOOL data type. On FALSE, aborts current fax and continues if there are any faxes left in the queue. On TRUE, aborts current fax and ignores all future faxes in the Queue while the break flag is not cleared by the ClearBreakFlag() function call.

FEV_ENDBREAK                Clears break flag set by AbortPort() allowing Fax Manager to continue.

FEV_ENDPORT                   This is NOT a message!  Use this to determine the This parameter value. If the event type value is less than FEV_BEGINPORT then This is a FAXPORT data type.

FEV_VOICE                          Not implemented in CLASS 1. This event is generated by a voice interrupt on the line.

FEV_QUEUE_OUT               This event occurs when an element of the queue has been removed. The lParam is a TCQueueItem far * pointer to a queue object in the queue pointed by This*.

FEV_QUEUE_IN                   This event occurs when a new element has been added to the queue. The lParam is a TCQueueItem far * pointer to a queue object in the queue pointed by This*.

FEV_BADFAXOBJ               This event occurs when the type of a sending fax object is not compatible with the receiver. For example, sending a BFT fax object and the receiver is not able the receive BFT pages.

FEV_MODEMTYPE            This event occurs when a ConnectPort() function was called and the CardName parameter was not given. lParam points to a TSTestResult structure..

FEV_HANGUP                      This event is sent when the modem hangs up.

FEV_MODEMCOM_ERROR      Fatal error, the modem doesn’t respond at all.

FEV_IDLE                             Port is in idle state, it is not used by anyone.

FEV_STATUSCHANGE       The state of the port is changed (training speed, etc.).

FEV_TERMINATE              Faxing finished, the only thing that follows is disconnecting. lParam points to a FAXPORT structure

FEV_ANSWER_INTERRUPT       Sent before auto answer and after reset.

FEV_DIAL_INTERRUPT    Sent before dial.

FEV_HANGUP_INTERRUPT       Sent before disconnecting.

FEV_POLLING_OBJECT   When the remote station wants to poll a document, this message is sent from the Driver to the Fax Manager to retrieve the fax object to be sent.

FEV_TRANSMITDATA      Number of bytes transmitted is returned to the 1Param

FEV_RECEIVEDATA          Number of bytes received is returned to the 1Param

FEV_PAGE_DATA_RECEIVED   Sent after every 2KB of received page data.  This event is sent only if this feature is enabled. lParam contains a pointer to a TSReceivedPageData structure, which contains all the information needed to access the received data. For more information about this structure please refer to the description of this structure in Chapter 6.

Parameters

LPSTR 

FaxMangerDLLName

Pointer to the event handler routine.

Return Value

Returns zero on success, otherwise returns an error code.

Sample Code

None at present.