WlanOpenHandle function (wlanapi.h)

The WlanOpenHandle function opens a connection to the server.


DWORD WlanOpenHandle(
  [in]  DWORD   dwClientVersion,
        PVOID   pReserved,
  [out] PDWORD  pdwNegotiatedVersion,
  [out] PHANDLE phClientHandle


[in] dwClientVersion

The highest version of the WLAN API that the client supports.

Value Meaning
Client version for Windows XP with SP3 and Wireless LAN API for Windows XP with SP2.
Client version for Windows Vista and Windows Server 2008


Reserved for future use. Must be set to NULL.

[out] pdwNegotiatedVersion

The version of the WLAN API that will be used in this session. This value is usually the highest version supported by both the client and server.

[out] phClientHandle

A handle for the client to use in this session. This handle is used by other functions throughout the session.

Return value

If the function succeeds, the return value is ERROR_SUCCESS.

If the function fails, the return value may be one of the following return codes.

Return code Description
pdwNegotiatedVersion is NULL, phClientHandle is NULL, or pReserved is not NULL.
Failed to allocate memory to create the client context.
Various error codes.
Too many handles have been issued by the server.


The version number specified by dwClientVersion and pdwNegotiatedVersion is a composite version number made up of both major and minor versions. The major version is specified by the low-order word, and the minor version is specified by the high-order word. The macros WLAN_API_VERSION_MAJOR(_v) and WLAN_API_VERSION_MINOR(_v) return the major and minor version numbers respectively. You can construct a version number using the macro WLAN_API_MAKE_VERSION(_major, _minor).

Windows XP with SP3 and Wireless LAN API for Windows XP with SP2:  WlanOpenHandle will return an error message if the Wireless Zero Configuration (WZC) service has not been started or if the WZC service is not responsive.


Minimum supported client Windows Vista, Windows XP with SP3 [desktop apps only]
Minimum supported server Windows Server 2008 [desktop apps only]
Target Platform Windows
Header wlanapi.h (include Wlanapi.h)
Library Wlanapi.lib
DLL Wlanapi.dll
Redistributable Wireless LAN API for Windows XP with SP2

See also