Delen via


WiFiAdapter Class

Definition

Note

Some information relates to pre-released product, which may be substantially modified before it's commercially released. Microsoft makes no warranties, express or implied, with respect to the information provided here.

Important

This API will be affected by upcoming changes to operating system behavior, planned for fall 2024. For more info, see Changes to API behavior for Wi-Fi access and location.

Use this class to enumerate local Wi-Fi adapters, initiate Wi-Fi scans, enumerate scan results, and to connect or disconnect individual adapters.

public ref class WiFiAdapter sealed
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
class WiFiAdapter final
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
public sealed class WiFiAdapter
Public NotInheritable Class WiFiAdapter
Inheritance
Object Platform::Object IInspectable WiFiAdapter
Attributes

Windows requirements

Device family
Windows 10 (introduced in 10.0.10240.0 - for Xbox, see UWP features that aren't yet supported on Xbox)
API contract
Windows.Foundation.UniversalApiContract (introduced in v1.0)

Remarks

Your code uses the static methods of this class.

Version history

Windows version SDK version Value added
1709 16299 ConnectAsync(WiFiAvailableNetwork,WiFiReconnectionKind,PasswordCredential,String,WiFiConnectionMethod)
1709 16299 GetWpsConfigurationAsync

Properties

NetworkAdapter

Note

Some information relates to pre-released product, which may be substantially modified before it's commercially released. Microsoft makes no warranties, express or implied, with respect to the information provided here.

Important

This API will be affected by upcoming changes to operating system behavior, planned for fall 2024. For more info, see Changes to API behavior for Wi-Fi access and location.

Gets information about a Wi-Fi adapter.

NetworkReport

Note

Some information relates to pre-released product, which may be substantially modified before it's commercially released. Microsoft makes no warranties, express or implied, with respect to the information provided here.

Important

This API will be affected by upcoming changes to operating system behavior, planned for fall 2024. For more info, see Changes to API behavior for Wi-Fi access and location.

Gets a list of available networks populated by the last Wi-Fi scan on this WiFiNetworkAdapter.

Methods

ConnectAsync(WiFiAvailableNetwork, WiFiReconnectionKind, PasswordCredential, String, WiFiConnectionMethod)

Note

Some information relates to pre-released product, which may be substantially modified before it's commercially released. Microsoft makes no warranties, express or implied, with respect to the information provided here.

Important

This API will be affected by upcoming changes to operating system behavior, planned for fall 2024. For more info, see Changes to API behavior for Wi-Fi access and location.

Connect this Wi-Fi device to a hidden network, with the given passphrase, connection method, and reconnection policy.

ConnectAsync(WiFiAvailableNetwork, WiFiReconnectionKind, PasswordCredential, String)

Note

Some information relates to pre-released product, which may be substantially modified before it's commercially released. Microsoft makes no warranties, express or implied, with respect to the information provided here.

Important

This API will be affected by upcoming changes to operating system behavior, planned for fall 2024. For more info, see Changes to API behavior for Wi-Fi access and location.

Connect this Wi-Fi device to a hidden network, with the given passphrase and reconnection policy.

ConnectAsync(WiFiAvailableNetwork, WiFiReconnectionKind, PasswordCredential)

Note

Some information relates to pre-released product, which may be substantially modified before it's commercially released. Microsoft makes no warranties, express or implied, with respect to the information provided here.

Important

This API will be affected by upcoming changes to operating system behavior, planned for fall 2024. For more info, see Changes to API behavior for Wi-Fi access and location.

Connect this Wi-Fi device to the specified network, with the specified passphrase and reconnection policy.

ConnectAsync(WiFiAvailableNetwork, WiFiReconnectionKind)

Note

Some information relates to pre-released product, which may be substantially modified before it's commercially released. Microsoft makes no warranties, express or implied, with respect to the information provided here.

Important

This API will be affected by upcoming changes to operating system behavior, planned for fall 2024. For more info, see Changes to API behavior for Wi-Fi access and location.

Connect this Wi-Fi device to the specified network, with the specified reconnection policy.

Disconnect()

Note

Some information relates to pre-released product, which may be substantially modified before it's commercially released. Microsoft makes no warranties, express or implied, with respect to the information provided here.

Important

This API will be affected by upcoming changes to operating system behavior, planned for fall 2024. For more info, see Changes to API behavior for Wi-Fi access and location.

Disconnects any active Wi-Fi connection through this adapter.

FindAllAdaptersAsync()

Note

Some information relates to pre-released product, which may be substantially modified before it's commercially released. Microsoft makes no warranties, express or implied, with respect to the information provided here.

Important

This API will be affected by upcoming changes to operating system behavior, planned for fall 2024. For more info, see Changes to API behavior for Wi-Fi access and location.

A static method that initiates an asynchronous operation to enumerate all Wi-Fi adapters in the system.

Note that if you do not specify that your app has the wiFiControl capability in your app manifest, this method fails.

FromIdAsync(String)

Note

Some information relates to pre-released product, which may be substantially modified before it's commercially released. Microsoft makes no warranties, express or implied, with respect to the information provided here.

Important

This API will be affected by upcoming changes to operating system behavior, planned for fall 2024. For more info, see Changes to API behavior for Wi-Fi access and location.

A static method that initiates an asynchronous operation to get a WiFiAdapter object.

Note that if you do not specify that your app has the wiFiControl capability in your app manifest, this method fails.

GetDeviceSelector()

Note

Some information relates to pre-released product, which may be substantially modified before it's commercially released. Microsoft makes no warranties, express or implied, with respect to the information provided here.

Important

This API will be affected by upcoming changes to operating system behavior, planned for fall 2024. For more info, see Changes to API behavior for Wi-Fi access and location.

A static method that returns an Advanced Query Syntax (AQS) string to be used to enumerate Wi-Fi adapters using Windows.Devices.Enumeration.DeviceInformation.FindAllAsync and related methods.

GetWpsConfigurationAsync(WiFiAvailableNetwork)

Note

Some information relates to pre-released product, which may be substantially modified before it's commercially released. Microsoft makes no warranties, express or implied, with respect to the information provided here.

Important

This API will be affected by upcoming changes to operating system behavior, planned for fall 2024. For more info, see Changes to API behavior for Wi-Fi access and location.

Performs WPS discovery to query the WPS methods supported by the network.

RequestAccessAsync()

Note

Some information relates to pre-released product, which may be substantially modified before it's commercially released. Microsoft makes no warranties, express or implied, with respect to the information provided here.

Important

This API will be affected by upcoming changes to operating system behavior, planned for fall 2024. For more info, see Changes to API behavior for Wi-Fi access and location.

A static method for determining whether the current user can access any of the Wi-Fi adapters on this device.

Note that if you do not specify that your app has the wiFiControl capability in your app manifest, this method always returns DeniedBySystem.

Always returns DeniedBySystem on Xbox.

ScanAsync()

Note

Some information relates to pre-released product, which may be substantially modified before it's commercially released. Microsoft makes no warranties, express or implied, with respect to the information provided here.

Important

This API will be affected by upcoming changes to operating system behavior, planned for fall 2024. For more info, see Changes to API behavior for Wi-Fi access and location.

Directs this adapter to initiate an asynchronous network scan.

Events

AvailableNetworksChanged

Note

Some information relates to pre-released product, which may be substantially modified before it's commercially released. Microsoft makes no warranties, express or implied, with respect to the information provided here.

Important

This API will be affected by upcoming changes to operating system behavior, planned for fall 2024. For more info, see Changes to API behavior for Wi-Fi access and location.

Event raised when a scan completes on this Wi-Fi adapter. This event cannot be raised from a background task.

Applies to