WapOpen

Send Feedback

This function opens a handle for sending a WAP message.

HRESULT WapOpen(
  const WAP_LAYER wlLayer,
  const DWORD dwLocalPort,
  WAP_HANDLE* const pwhHandle,
  HANDLE* const phMessageAvailableEvent 
);

Parameters

wlLayer
[in] A WAP_LAYER structure containing the WAP layer for which to open the handle.
dwLocalPort
[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.
pwhHandle
[out] Pointer to the handle to open. This handle will be used in subsequent WAP function calls.
phMessageAvailableEvent
[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.

Return Values

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

Remarks

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.

Requirements

Pocket PC: Pocket PC 2002 and later.
Smartphone: Smartphone 2002 and later.
OS Versions: Windows CE 3.0 and later.
Header: Wap.h.
Library: Wap.lib.

See Also

WapClose | WAP_LAYER


Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.


Show: