Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.


Windows Mobile 6.5
A version of this page is also available for

This function opens a handle for sending a WAP message.

  const WAP_LAYER wlLayer,
  const DWORD dwLocalPort,
  WAP_HANDLE* const pwhHandle,
  HANDLE* const phMessageAvailableEvent 


[in] A WAP_LAYER structure containing the WAP layer for which to open the handle.


[in] Local port to use. This port is similar to a sockets port, and is used by WAP applications in sending and receiving PDUs. If the requested port is already in use, the function will fail. If a specific local port is not required, a value of 0 can be passed in for this parameter.


[out] Pointer to the handle to open. This handle will be used in subsequent WAP function calls.


[out] Pointer to the handle for an event to signal when a new WAP packet arrives. The WAP provider creates this event and destroys it via WapClose. For more information, see the "Remarks" section.

Returns S_OK if successful. If unsuccessful, this function returns the standard values E_INVALIDARG, E_OUTOFMEMORY, E_UNEXPECTED, and E_FAIL.

Only one WAP client can have a handle bound to a specific local port at a time. The current event handle will be destroyed on a call to WapClose. Behavior is undefined if the user destroys the event handle directly, instead of by calling WapClose.

Applications should only wait on the event by calling suitable Microsoft Win32® API functions (WaitForSingleObject, WaitForMultipleObjects, and so on). They should should not use the handle with any other API function, for example, SetEvent, ResetEvent.

Windows Embedded CEWindows Embedded CE 6.0 and later
Windows MobilePocket PC 2002 and later, Smartphone 2002 and later

Community Additions

© 2015 Microsoft