Platform SDK: Fax Services

Using the COM Implementation in a C/C++ Program

The following steps summarize typical programming tasks required to incorporate the functionality of the Fax Service Client API in a C/C++ fax client application if you are using the COM implementation.

To code a fax client application

  1. Create an instance of a FaxServer object by calling the CoCreateInstance function. Then connect to an active fax server using a call to the IFaxServer::Connect interface method. For more information, see Connecting to a Fax Server and IFaxServer.
  2. Create the objects you need by calling one or more of the following IFaxServer interface methods:
  3. After creating an instance of a FaxPort object for a specific port, call the IFaxPort::GetRoutingMethods interface method to create a FaxRoutingMethods object. Also call the IFaxRoutingMethods::get_Item interface method to create a FaxRoutingMethod object. The FaxRoutingMethod object allows you to query and modify the fax routing information for a fax port. For more information, see Managing Fax Routing Data.
  4. To create a FaxStatus object, call the IFaxPort::GetStatus interface method. The FaxStatus object allows you to provide real-time status information about a fax port.
  5. After creating an instance of a FaxDoc object, transmit a fax document by calling the IFaxDoc::Send interface method. Note that the application must supply transmission information such as the fax number and the name of the file to transmit. The client can also supply other data that appears on the cover page by setting various properties of the FaxDoc object. For more information, see Transmitting Faxes.
  6. Call the SysFreeString function when appropriate to deallocate the resources allocated by all interface methods that end with get_PropertyName. For more information, see Freeing Fax Resources.
  7. Call the IFaxServer::Disconnect interface method to terminate the connection to the fax server. Then call the IUnknown::Release method to allow the FaxServer object to deallocate itself. For more information, see Disconnecting from a Fax Server.

In addition, the application may need to call other interface methods to query device or server configuration data, to manage fax jobs, and to destroy additional interface pointers. You may also need to create an instance of a FaxTiff object and call IFaxTiff interface methods to retrieve information about a file the fax service has sent or received.

Note that a client application must call the CoCreateInstance function to create an instance of a FaxServer or FaxTiff object. However, do not call the CoCreateInstance function to create FaxDoc, FaxJobs, FaxJob, FaxPorts, FaxPort, FaxStatus, FaxRoutingMethods, or FaxRoutingMethod objects. For more information about creating and deallocating fax client objects, see the steps listed with each interface topic and the hierarchical diagram in The Fax Client Object Model.

For more information, see Fax Server Configuration Management, Fax Device Management, Managing Fax Jobs, and General Fax Client Programming Tasks.