WapOpen (Compact 2013)
3/26/2014
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 that contains 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 when sending and receiving protocol data units (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 by using WapClose. For more information, see the "Remarks" section.
Return Value
Value |
Description |
---|---|
S_OK |
Indicates the function was successful. |
E_INVALIDARG |
Indicates one or more invalid arguments. |
E_OUTOFMEMORY |
Indicates an out-of-memory error. |
E_UNEXPECTED |
Indicates an unexpected failure. |
E_FAIL |
Indicates an unspecified failure. |
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 directly destroys the event handle, instead of by calling WapClose.
Applications should wait on the event only by calling suitable Microsoft Win32 API functions; for example, WaitForSingleObject or WaitForMultipleObjects. They should not use the handle with any other API function; for example, SetEvent or ResetEvent.
Requirements
Header |
wap.h |
Library |
Wap.lib |