ConnectPortExt

#include ”faxcpp.h”

PORTFAX far ConnectPortExt(   LPSTR          PortName,
LPSTR          FaxName,
LPSTR          IniFileName)

Class 1.

Class 2.

Class 2.0

Brooktrout

 

GammaLink

 

Dialogic

 

NMS

 

g

g

g

g

g

g

Description

Connects the port to the fax hardware. Creates the appropriate class which can be Command Class 1, Command Class 1.0 33.6 Fax, Command Class 2 or Command Class 2.0 or Brooktrout Fax Channel. The fax hardware must be registered in the user-supplied IniFileName file. The Command Class 3 is reserved for future development.  Returns the address of the fax port object. Returns NULL on error.

Parameters

LPSTR 

PortName

Name of a port.(COM1, COM2, Channel1... etc.). For fax channels this parameter should start with ‘Channel’.

LPSTR

FaxName

Name of a fax. For COM ports the name of the fax refers to a section in the IniFaxName.INI file.

For Brooktrout channels this parameter should point to the string “Brooktrout Channel”.

For GammaLink channels this parameter should point to the string “Gamma Channel”.

For Dialogic channels this parameter should point to the string “Dialogic Channel”.

LPSTR

IniFaxName

Name of the ini file that contains the setting for the fax hardware.

For Brooktrout channels this parameter should point to the name of the user-configuration file (btcall.cfg).

For GammaLink Channels this parameter should point to the name of the GammaLink configuration file. The string can contain a full path ( “d:\gamma\fax\gfax.$dc” ) or only the filename. In the latter case the function tries to open the config file in the directory specified by the environment variable GFAX.

For Dialogic and NMS channels this parameter should be NULL.

Return Value

Returns fax port on success, otherwise returns zero.

Remarks:

When using a Brooktrout TR1034 card you should set the number of rings to 1 in the Brooktrout Configuration Tool. The card will answer an incoming call after detecting the number of rings specified by the second parameter of SetAutoAnswer function.

Sample Code

CImgApp *pApp = (CImgApp *)AfxGetApp();

 

// Reconnects the outgoing port.

if(pApp->FaxPorts[0])

            DisconnectPort(pApp->FaxPorts[0]);      // Disconnect port.

if(!(pApp->FaxPorts[0] = ConnectPortExt(szPortName, szFaxName, szUserSetting))) {

            // Unable to connect port

},