次の方法で共有


WapOpen (Windows Embedded CE 6.0)

1/6/2010

This function opens a handle for sending a WAP message.

Syntax

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 Value

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

Header wap.h
Library Wap.lib
Windows Embedded CE Windows Embedded CE 6.0 and later

See Also

Reference

WapClose
WAP_LAYER

Concepts

WAP Functions