Platform SDK: Fax Services

FaxConnectFaxServer

The FaxConnectFaxServer function connects a fax client application to the specified fax server. The function returns a fax server handle that is required to call other fax client functions that facilitate job, device, configuration, and document management.

A fax client application must call the FaxConnectFaxServer function successfully before it calls any other fax client function.

BOOL WINAPI FaxConnectFaxServer(
  LPCTSTR MachineName OPTIONAL,  // fax server name
  LPHANDLE FaxHandle             // handle to the fax server
);

Parameters

MachineName
[in] Pointer to a constant null-terminated character string that names the target fax server. If the pointer is NULL, the function connects the application to the fax server on the local computer.
FaxHandle
[out] Pointer to a variable that receives a fax server handle that is required on subsequent calls to other fax client functions. If the fax server returns a NULL handle, it indicates an error.

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_INVALID_PARAMETER The FaxHandle parameter is NULL.
ERROR_NOT_ENOUGH_MEMORY An error occurred during memory allocation.

Remarks

The fax client application must call the FaxClose function to disconnect from the fax server and deallocate the handle that the FaxConnectFaxServer function returns. For more information, see Connecting to a Fax Server and Disconnecting from a Fax Server.

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, FaxClose