phoneOpen (Windows CE 5.0)

Send Feedback

This function opens the specified phone device. A phone device can be opened using either owner privilege or monitor privilege. An application that opens the phone with owner privilege can control the phone's lamps, display, ringer, and hookswitch or hookswitches. An application that opens the phone device with monitor privilege is notified only about events that occur at the phone, such as hookswitch changes or button presses.

Ownership of a phone device is exclusive. In other words, only one application can have a phone device opened with owner privilege at a time. The phone device can, however, be opened multiple times with monitor privilege.

LONG WINAPI phoneOpen(HPHONEAPP hPhoneApp,DWORD dwDeviceID,LPHPHONE lphPhone,DWORD dwAPIVersion,DWORD dwExtVersion,DWORD_PTR dwCallbackInstance,DWORD dwPrivilege);

Parameters

  • hPhoneApp
    Handle to the application's registration with TAPI.
  • dwDeviceID
    Phone device to be opened.
  • lphPhone
    Pointer to an HPHONE handle that identifies the open phone device. Use this handle to identify the device when invoking other phone control functions.
  • dwAPIVersion
    API version number under which the application and Telephony API have agreed to operate. This number is obtained from the phoneNegotiateAPIVersion function.
  • dwExtVersion
    Extension version number under which the application and the service provider agree to operate. This number is zero if the application does not use any extensions. This number is obtained from the phoneNegotiateExtVersion function.
  • dwCallbackInstance
    User instance data passed back to the application with each message. This parameter is not interpreted by the Telephony API.
  • dwPrivilege
    Privilege requested. This parameter uses one and only one of the PHONEPRIVILEGE constants.

Return Values

Returns zero if the request succeeds or a negative error number if an error occurs. The following table shows the return values for this function.

Value Description
PHONEERR_ALLOCATED The specified resource is already allocated.
PHONEERR_NODRIVER The driver was not found.
PHONEERR_BADDEVICEID The device identifier is incorrect.
PHONEERR_NOMEM Not enough memory is available.
PHONEERR_INCOMPATIBLEAPIVERSION The API version is incompatible.
PHONEERR_OPERATIONFAILED The operation failed.
PHONEERR_INCOMPATIBLEEXTVERSION The extension version is incompatible.
PHONEERR_OPERATIONUNAVAIL The operation is unavailable.
PHONEERR_INVALAPPHANDLE The handle to the application's registration with TAPI is invalid.
PHONEERR_RESOURCEUNAVAIL The resources are unavailable.
PHONEERR_INVALPOINTER The pointer is invalid.
PHONEERR_UNINITIALIZED A parameter is unintialized.
PHONEERR_INVALPRIVILEGE The privilege is invalid.
PHONEERR_INUSE The phone device is in use.
PHONEERR_REINIT If TAPI reinitialization has been requested, for example as a result of adding or removing a telephony service provider, then phoneInitializeEx or phoneOpen requests are rejected with this error until the last application shuts down its usage of the API (using phoneShutdown), at which time the new configuration becomes effective and applications are once again permitted to call phoneInitializeEx.
PHONEERR_NODEVICE The device was not found.
PHONEERR_INIFILECORRUPT The INI file is corrupted.

Remarks

When opening a phone device with monitor privileges, the application is sent messages when events occur that change the status of the phone. Messages sent to the application include PHONE_BUTTON and PHONE_STATE. The latter provides an indication of the phone's status item that has changed.

When opening a phone with owner privilege, the phone device can be manipulated in ways that affect the state of the phone device. An application should only open a phone using owner privilege if it actively wants to manipulate the phone device, and it should close the phone device when finished to allow other applications to control the phone.

When an application opens a phone device, it must specify the negotiated API version and, if it wants to use the phone's extensions, the phone's device-specific extension version. This version number should have been obtained with the phoneNegotiateAPIVersion and phoneNegotiateExtVersion functions. Version numbering allows the mix and match of different application versions with different API versions and service-provider versions.

Note   This function is for TAPI version 2.0 and later.

Requirements

OS Versions: Windows CE 3.0 and later.
Header: Tapi.h.
Link Library: Coredll.lib.

See Also

phoneNegotiateAPIVersion | phoneNegotiateExtVersion

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.