Using the Wi-Fi Direct functions

This topics shows how to use Wi-Fi Direct functions in desktop apps. Starting on Windows 8 and Windows Server 2012, Wi-Fi Direct functions were added to the Native Wifi API.

The Wi-Fi Direct feature is based on the development of the Wi-Fi Peer-to-Peer Technical Specification v1.1 by the Wi-Fi Alliance (see Wi-Fi Alliance Published Specifications). The goal of the Wi-Fi Peer-to-Peer Technical Specification is to provide a solution for Wi-Fi device-to-device connectivity without the need for either a Wireless Access Point (wireless AP) to setup the connection or the use of the existing Wi-Fi ad hoc (IBSS) mechanism.


Ad hoc mode might not be available in future versions of Windows. Starting with Windows 8.1 and Windows Server 2012 R2, use Wi-Fi Direct instead.


The following functions support the Wi-Fi Direct feature.

For a desktop app, the Wi-Fi Direct feature requires that Wi-FI Direct devices be previously paired by the user with the Windows Pairing experience user interface. Once this pairing is completed, a profile is stored that allows the Wi-Fi Direct functions to be used to start a Wi-Fi Direct session to establish a connection between the Wi-Fi Direct devices.

In order to use Wi-Fi Direct, an app must first obtain a handle to the Wi-Fi Direct service by calling the WFDOpenHandle function. The Wi-Fi Direct (WFD) handle returned by the WFDOpenHandle function is used for subsequent Wi-Fi Direct function calls made to the Wi-Fi Direct service.

The WFDStartOpenSession function starts an asynchronous operation to start an on-demand connection to a specific Wi-Fi Direct device. The target Wi-Fi device must previously have been paired through the Windows Pairing experience. When the asynchronous operation completes, the callback function specified in the pfnCallback parameter is called.

Once an application is done using the Wi-Fi Direct service, the application should call the WFDCloseHandle function to signal to the Wi-Fi Direct service that the application is done using the service. This allows the Wi-Fi Direct service to release resources used by the application.

For more information on Wi-Fi Direct for use in Windows Store apps, see PeerFinder and related classes in the Windows.Networking.Proximity namespace.

Other resources

About Native Wifi

About the Native Wifi API

About the Wi-Fi Direct feature