Platform SDK: TAPI

TSPI_phoneOpen

The TSPI_phoneOpen function opens the phone device whose device identifier is given, returning the service provider's opaque handle for the device and retaining TAPI's opaque handle for the device for use in subsequent calls to the PHONEEVENT procedure.

LONG TSPIAPI TSPI_phoneOpen(
  DWORD dwDeviceID,       
  HTAPIPHONE htPhone,     
  LPHDRVPHONE lphdPhone,  
  DWORD dwTSPIVersion,    
  PHONEEVENT lpfnEventProc  
);

Parameters

dwDeviceID
The phone device to be opened.
htPhone
The TAPI opaque handle for the phone device to be used in subsequent calls to the PHONEEVENT callback procedure to identify the device.
lphdPhone
A pointer to an HDRVPHONE where the service provider writes its handle for the phone device to be used by TAPI in subsequent calls to identify the device.
dwTSPIVersion
The TSPI version negotiated through TSPI_phoneNegotiateTSPIVersion under which the service provider can operate.
lpfnEventProc
A pointer to the PHONEEVENT callback procedure supplied by TAPI that the service provider calls to report subsequent events on the phone.

Return Values

Returns zero if the function succeeds, or an error number if an error occurs. Possible return values are as follows:

PHONEERR_ALLOCATED, PHONEERR_NOMEM, PHONEERR_INCOMPATIBLEAPIVERSION, PHONEERR_RESOURCEUNAVAIL, PHONEERR_NODRIVER, PHONEERR_OPERATIONFAILED, PHONEERR_INUSE, PHONEERR_OPERATIONUNAVAIL, PHONEERR_INIFILECORRUPT.

Remarks

Opening a phone entitles TAPI to make further requests on the phone. The phone becomes active in the sense that the service provider can report asynchronous events such as hookswitch changes or button presses. The service provider reserves whatever nonsharable resources are required to manage the phone. For example, opening a phone accessed through a comm port and modem should result in opening the comm port, making it no longer available for use by other applications.

If the function succeeds, both TAPI and the service provider become committed to operating under the specified interface version number for this open device. Subsquent operations and events identified using the exchanged opaque phone handles conform to that interface version. This commitment and the validity of the handles remain in effect until TAPI closes the phone using TSPI_phoneClose or until the service provider reports the PHONE_CLOSE event. If the function is not successful, no such commitment is made and the handles are not valid.

Requirements

  Windows NT/2000: Requires Windows NT 4.0 SP3 or later.
  Windows 95/98: Requires Windows 95 or later.
  Version: Requires TAPI 1.3 or later.
  Header: Declared in Tspi.h.

See Also

PHONE_CLOSE, PHONEEVENT, TSPI_phoneClose, TSPI_phoneNegotiateTSPIVersion