FaxMan SDK Version 4.7
Examining Your FaxMan System

Now that you know how to register with the FaxMan system and how to handle FaxMan's notification messages, the next step is to do a little exploring. This section will illustrate how to examine your FaxMan system to determine:

 

 

You'll also find out how to add fax devices, which you will have to do at least once before FaxMan will work (We recommend adding fax devices as part of your application's installation, but you can just as easily make it a part of your application proper).

 

Checking for installed Fax Devices

One of the first things your application should do is to call the FaxEnumDevices function to determine if there are any faxmodems currently configured for use with FaxMan. Calling FaxEnumDevices causes the FaxMan server to immediately send several FAXMODEMMSG notification messages to your application, one message for each installed device. Note that when the FaxEnumDevices function returns, your application will have already received and processed all of these messages, so it will know which faxmodems are installed before the next line in your application is processed. The following code fragment indicates how this might look in your application:

 

//

// We assume that the application has already registered via

// FaxRegisterApp and setup the proper subscriptions using

// FaxSubscribe, as illustrated above.

//

//

// The following code would be added to handle the FAXMODEMMSG

// sent by the FaxMan server to your application. For the purposes

// of this example, imagine it being part of the window proc setup

// to handle FaxMan messages.

//

// The variable nFaxModems referenced below is declared as a

// global int.

//

case FAXMODEMMSG:

 pDev = (PFAXDEVICE)lParam;

 nFaxModems++; 

 break;

 

//

// Once you've setup your message handler (as above), the

// rest is pretty simple...

//

nFaxModems = 0;  //reset this global variable

FaxEnumDevices(pInfo); //enumerate the devices

//

// At this point, nFaxModems should contain the number

// of installed faxmodems.

//

if (!nFaxModems) {

 MsgBox(NULL, "No Installed Faxmodems!", NULL, MB_OK);

}

else {

 // we have at least one faxmodem...

 

It's a pretty straightforward concept once you get used to the idea of FaxEnumDevices causing FaxMan to call SendMessage for each installed faxmodem. By calling FaxEnumDevices at the beginning of your application, and then responding to all FAXMODEMMSG notification messages, your app can easily keep an up to date list of all installed devices, including which port they're on and what they're currently doing (these things are stored in the FAXDEVICE structure passed in the lParam of the message).

 

 


© 2013 Data Techniques, Inc. All Rights Reserved.

Send comments on this topic.