FaxMan SDK Version 4.7
Working With FaxModems

Configuring FaxModems to work with FaxMan

The first time you run your application after installing FaxMan, you’ll need to configure one or more faxmodems for FaxMan to use. There are two ways to add devices to the FaxMan server. The easiest method is to have the FaxMan server query a system’s installed comm ports looking for supported modems. Alternatively, you can specify that the FaxMan server add a modem on a specific comm port.


To auto-detect faxmodems using the ActiveX interface, simply call the AutoDetect method. This will cause the server to check all installed comm ports for valid faxmodems, and will store all faxmodems found in the FaxMan configuration file (faxman4.ini). To add a device on a single port, or just to check if a given comm port has a faxmodem attached, use the AddDevice method, passing in the comm port to check. As you can see, you could easily duplicate the functionality of the AutoDetect method by calling AddDevice for each possible comm port.


In general, your app will want to auto-detect faxmodems rarely; certainly, you will not want to auto-detect on a timer, or even every time your application starts up. FaxMan keeps a record of which faxmodems are currently installed, and doesn’t need to have this refreshed unless a device is added or removed. For this reason, you may want to add an option to your application to allow the user to perform an auto-detect at his discretion, since hopefully the user will have some idea when faxmodems are altered.


Also, keep in mind that AutoDetect or AddDevice will not affect any currently active faxmodems. So if AutoReceive is on, for instance, AutoDetect will have no effect whatsoever on any faxmodems which are configured to receive, because they’re busy looking for a ring to come in.


You should note that FaxMan takes some time to perform an auto-detect. This time will vary from system to system, but is generally about 2 to 5 seconds. Your app can know exactly when this is completed by watching for the ConfigurationDone event to be fired. When this is fired, all faxmodem configuration is completed — this is true when performing an auto-detect, calling AddDevice for a single port, or on application start up. Once the ConfigurationDone event has been fired, your app can query the DeviceCount property to see how many faxmodems were discovered by FaxMan. If DeviceCount is zero, then there were no devices found; this indicates a probable error condition, of course. Check the Appendix for hints on how to correct the problem.


Exploring Installed FaxModems

Once you have configured one or more faxmodems on the server you may use the Devices property to obtain information about them. The Devices property is an array of strings which describes each configured modem. The returned string will display the Modem Class (FaxMan works only with Class 1, Class 2,  Class 2.0 and Class 2.1 faxmodems) and the comm port on which it is installed, for instance, ‘Class 1 Modem on Port 1.’ You should note that the Devices array is not indexed by comm port! Devices(0) is not necessarily the faxmodem on comm 1. The devices are not guaranteed to be sorted in any particular way, or even to be sorted the same between runs of your application.


To display a list of all the configured devices you can use a loop like this:


Dim I%


For I=0 to FaxMan1.DeviceCount-1

 Print FaxMan1.Devices(I)

Next I


If you’re not into parsing the Devices string to get the information about a port, you can use the following ActiveX properties to get/set information about each faxmodem:


DeviceSend(nDevice)  Returns TRUE if device can send

DeviceRecv(nDevice)  Returns TRUE if device can receive

DeviceClass1(nDevice)  Returns TRUE if device is Class 1

DeviceClass2(nDevice)  Returns TRUE if device is Class 2

DeviceClass20(nDevice)  Returns TRUE if device is Class 2.0

DeviceClass21(nDevice)  Returns TRUE if device is Class 2.1

DeviceIsSending(nDevice) Returns TRUE if device is currently sending

DeviceIsReceiving(nDevice) Returns TRUE if device is currently receiving

DeviceQueue(nDevice)  Returns the id of the queue the device belongs to


You can use these properties to alter the flags as well–just call the method with the desired setting. For example, to turn on receive support for a given device, just call DeviceRecv(nDevice) = TRUE. These property changes take effect immediately – there is no need to restart the server.


These properties are indexed in the same way that the Devices array is indexed.


You can use the DeviceFlags property instead (but is not as easy to use as the properties listed above – however, there are some flags you can’t reach using these properties). DeviceFlags is an array, indexed identically to the Devices array, which returns a long integer containing flags reflecting the current settings for a given faxmodem. By examining the individual flags, you can quickly determine all the aspects of a faxmodem.


The following list details the flags returned by DeviceFlags and their meanings:



Flag Value(Decimal)



PORT_SEND – This faxmodem is configured for sending


PORT_RX – This faxmodem is configured for receiving


PORT_SENDING – This faxmodem is currently sending a fax


PORT_RECEIVING – This faxmodem is currently receiving a fax


PORT_CLS1 – This faxmodem supports Class 1 commands


PORT_CLS2 – This faxmodem supports Class 2 commands


PORT_CLS20 – This faxmodem supports Class 2.0 commands


PORT_CLS21 – This faxmodem supports Class 2.1 commands


The following VB code snippet shows how to use the DeviceFlags array to list which faxmodems are currently sending:


Dim I%


For I=0 to FaxMan1.DeviceCount-1

 If (FaxMan1.DeviceFlags(I) And 4) Then Print "Device "& Str(I) &" Is Sending"

Next I


The DeviceFlags property is read/write, which means that it can also be used to alter a faxmodem’s current configuration. For instance, by setting the proper DeviceFlags, you can easily turn off a faxmodem’s ability to receive faxes. The following example shows how to do just that:


FaxMan1.DeviceFlags(0) = (FaxMan1.DeviceFlags(0) And (Not 2%))


You can obviously extend this to alter any of the faxmodem’s flags. Be careful when altering the DeviceFlags–by setting the flags incorrectly, you could easily render a faxmodem useless.


DeviceInit and DeviceReset Properties

Every faxmodem supported by FaxMan can trace its roots all the way back to the original Hayes modem. As a result, all faxmodems supported by FaxMan support some superset of the original Hayes command set, the AT command set (so-called because almost all of its commands begin with the letters AT).


FaxMan uses these AT commands to configure your faxmodems for sending and receiving, and there are specific Class 1, Class 2,  Class 2.0 or Class 2.1 commands that are required to be supported by your faxmodem. There are not, however, hard rules about such things as whether the speaker on your faxmodem is on or off, whether your faxmodem is configured to wait for a dial tone before dialing, or how to reset your faxmodem back to a "safe" state. For this reason, FaxMan allows you to override its default settings for these unspecified faxmodem states through the DeviceInit and DeviceReset settings.


In general, you should only alter these properties if your faxmodem is behaving oddly, i.e., not detecting busy signals, dialing without waiting for a dialtone, not using the desired speaker setting, etc... By setting the DeviceInit property, you can override FaxMan’s default settings and use a initialization string specific to your faxmodem. By setting the DeviceReset property, you can let FaxMan know how to reset your faxmodem (this property is rarely, if ever, used, so the odds are you should never encounter a use for it).



© 2013 Data Techniques, Inc. All Rights Reserved.

Send comments on this topic.