Platform SDK: Fax Services

FaxClose

The FaxClose function closes the following types of fax handles:

A fax client application must call the FaxClose function as the last function before it terminates. The CloseHandle function cannot close the handle to a fax server or a fax port.

BOOL WINAPI FaxClose(
  HANDLE FaxHandle  // fax handle to close
);

Parameters

FaxHandle
[in] Specifies the fax handle to close. This value can be a fax server handle returned by a call to the FaxConnectFaxServer function, or a fax port handle returned by a call to the FaxOpenPort function.

Return Values

If the function succeeds, the return value is nonzero.

If the function fails, the return value is zero. To get extended error information, call GetLastError. GetLastError can return one of the following errors.

Error code Description
ERROR_ACCESS_DENIED Access is denied. FAX_PORT_QUERY access is required to close a fax port handle.
ERROR_INVALID_HANDLE The FaxHandle parameter is invalid.

Remarks

When the FaxClose function closes a handle allocated by the FaxConnectFaxServer function, the function disconnects the calling application from the specified fax server.

A fax client application continues to receive fax events from the fax service after the application successfully calls the FaxClose function to close a fax server handle. This permits the fax service to shut down and conserve system resources when the service has been idle for an extended period. If you keep the handle to the fax server open, the fax service does not shut down.

For more information, see Enabling an Application to Receive Notifications of Fax Events, Connecting to a Fax Server and Disconnecting from a Fax Server, and FaxInitializeEventQueue.

Requirements

  Windows NT/2000: Requires Windows 2000.
  Windows 95/98: Requires Windows 95 or later. Available as a redistributable with BackOffice Small Business Server.
  Header: Declared in Winfax.h.
  Library: Included as a resource in Winfax.dll.
  Unicode: Implemented as Unicode and ANSI versions on all platforms.

See Also

Fax Service Client Application Programming Interface Overview, Fax Service Client API Functions, FaxConnectFaxServer, FaxOpenPort