This browser is no longer supported.

Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.

Download Microsoft Edge More info about Internet Explorer and Microsoft Edge
public:
 static DeviceWatcher ^ CreateWatcher();
/// [Windows.Foundation.Metadata.Overload("CreateWatcher")]
 static DeviceWatcher CreateWatcher();
[Windows.Foundation.Metadata.Overload("CreateWatcher")]
public static DeviceWatcher CreateWatcher();
function createWatcher()
Public Shared Function CreateWatcher () As DeviceWatcher

Returns

Remarks

The DeviceWatcher first performs an initial enumeration of devices, raising an Added event for each device that it finds, and raising an EnumerationCompleted event when the initial enumeration is complete. After the initial enumeration is complete, it raises events when a device is added, deleted, or updated.

See the DeviceWatcher class for an example.

An app must subscribe to all of the added , removed , and updated events to be notified when there are device additions, removals or updates. If an app handles only the added event, it will not receive an update if a device is added to the system after the initial device enumeration completes.

public:
 static DeviceWatcher ^ CreateWatcher(Platform::String ^ aqsFilter);
/// [Windows.Foundation.Metadata.Overload("CreateWatcherAqsFilter")]
 static DeviceWatcher CreateWatcher(winrt::hstring const& aqsFilter);
[Windows.Foundation.Metadata.Overload("CreateWatcherAqsFilter")]
public static DeviceWatcher CreateWatcher(string aqsFilter);
function createWatcher(aqsFilter)
Public Shared Function CreateWatcher (aqsFilter As String) As DeviceWatcher

Parameters

An AQS string that filters the DeviceInformation objects to enumerate. Typically this string is retrieved from the GetDeviceSelector method of a class that interacts with devices. For example, GetDeviceSelector retrieves the string for the StorageDevice class.

Returns

This overload is not available from JavaScript. To create a DeviceWatcher from an AQS string in JavaScript, use the CreateWatcher(String, IIterable_1) overload and pass null as the second parameter.

The DeviceWatcher first performs an initial enumeration of devices, raising an Added event for each device that it finds, and raising an EnumerationCompleted event when the initial enumeration is complete. After the initial enumeration is complete, it raises events when a device is added, deleted, or updated.

An app must subscribe to all of the added , removed , and updated events to be notified when there are device additions, removals or updates. If an app handles only the added event, it will not receive an update if a device is added to the system after the initial device enumeration completes.

See the DeviceWatcher class for an example.

public:
 static DeviceWatcher ^ CreateWatcher(DeviceClass deviceClass);
/// [Windows.Foundation.Metadata.DefaultOverload]
/// [Windows.Foundation.Metadata.Overload("CreateWatcherDeviceClass")]
 static DeviceWatcher CreateWatcher(DeviceClass const& deviceClass);
[Windows.Foundation.Metadata.DefaultOverload]
[Windows.Foundation.Metadata.Overload("CreateWatcherDeviceClass")]
public static DeviceWatcher CreateWatcher(DeviceClass deviceClass);
function createWatcher(deviceClass)
Public Shared Function CreateWatcher (deviceClass As DeviceClass) As DeviceWatcher

Parameters

Remarks

The DeviceWatcher first performs an initial enumeration of devices, raising an Added event for each device that it finds, and raising an EnumerationCompleted event when the initial enumeration is complete. After the initial enumeration is complete, it raises events when a device is added, deleted, or updated.

An app must subscribe to all of the added , removed , and updated events to be notified when there are device additions, removals or updates. If an app handles only the added event, it will not receive an update if a device is added to the system after the initial device enumeration completes.

See the DeviceWatcher class for an example.

public:
 static DeviceWatcher ^ CreateWatcher(Platform::String ^ aqsFilter, IIterable<Platform::String ^> ^ additionalProperties);
/// [Windows.Foundation.Metadata.Overload("CreateWatcherAqsFilterAndAdditionalProperties")]
 static DeviceWatcher CreateWatcher(winrt::hstring const& aqsFilter, IIterable<winrt::hstring> const& additionalProperties);
[Windows.Foundation.Metadata.Overload("CreateWatcherAqsFilterAndAdditionalProperties")]
public static DeviceWatcher CreateWatcher(string aqsFilter, IEnumerable<string> additionalProperties);
function createWatcher(aqsFilter, additionalProperties)
Public Shared Function CreateWatcher (aqsFilter As String, additionalProperties As IEnumerable(Of String)) As DeviceWatcher

Parameters

An iterable list of additional properties to include in the Properties property of the DeviceInformation objects in the enumeration results. For more info on what the properties represent, see Device information properties .

Returns

Remarks

The DeviceWatcher first performs an initial enumeration of devices, raising an Added event for each device that it finds, and raising an EnumerationCompleted event when the initial enumeration is complete. After the initial enumeration is complete, it raises events when a device is added, deleted, or updated.

An app must subscribe to all of the added , removed , and updated events to be notified when there are device additions, removals or updates. If an app handles only the added event, it will not receive an update if a device is added to the system after the initial device enumeration completes.

See the DeviceWatcher class for an example.

public:
 static DeviceWatcher ^ CreateWatcher(Platform::String ^ aqsFilter, IIterable<Platform::String ^> ^ additionalProperties, DeviceInformationKind kind);
/// [Windows.Foundation.Metadata.Overload("CreateWatcherWithKindAqsFilterAndAdditionalProperties")]
 static DeviceWatcher CreateWatcher(winrt::hstring const& aqsFilter, IIterable<winrt::hstring> const& additionalProperties, DeviceInformationKind const& kind);
[Windows.Foundation.Metadata.Overload("CreateWatcherWithKindAqsFilterAndAdditionalProperties")]
public static DeviceWatcher CreateWatcher(string aqsFilter, IEnumerable<string> additionalProperties, DeviceInformationKind kind);
function createWatcher(aqsFilter, additionalProperties, kind)
Public Shared Function CreateWatcher (aqsFilter As String, additionalProperties As IEnumerable(Of String), kind As DeviceInformationKind) As DeviceWatcher

Parameters