locked
DeviceWatcher vs PnpObjectWatcher

    Question

  • Hello, 

    Could anyone please tell me the difference between DeviceWatcher and PnpObjectWatcher?

    I read them on MSDN, but I still couldn't tell the differences.

    Both classes share the same Events, Methods, and Properties.

    and I don't understand the differences between Pnp object and device object. 

    Thanks!


    Jerry

    Monday, May 21, 2012 8:23 AM

Answers

  • Jerry,

    Use the DeviceWatcher class to enumerate devices dynamically, so that the app receives notifications if devices are added, removed, or changed after the initial enumeration is complete.

    Best Wishes - Eric

    Friday, May 25, 2012 5:21 AM
    Moderator
  • Jerry,

    DeviceWatcher (and DeviceInformation) only operates on interfaces (and their properties), while PnpWatcher (and PnpObject) can also look for other object types (e.g. containers).


    So if you use DeviceWatcher, in your callback you can fetch any property set on the interface specified by the DeviceInformation object that gets returned.


    This page has the list of canonical properties for all object types, and also shows how to specify properties using the GUID PID format:


    http://msdn.microsoft.com/en-us/library/windows/apps/hh465007.aspx


    Best Wishes - Eric

    Friday, May 25, 2012 5:22 PM
    Moderator

All replies

  • Jerry,

    I will research this fo you.

    Best Wishes - Eric

    Tuesday, May 22, 2012 2:19 PM
    Moderator
  • Jerry,

    Use the DeviceWatcher class to enumerate devices dynamically, so that the app receives notifications if devices are added, removed, or changed after the initial enumeration is complete.

    Best Wishes - Eric

    Friday, May 25, 2012 5:21 AM
    Moderator
  • Jerry,

    DeviceWatcher (and DeviceInformation) only operates on interfaces (and their properties), while PnpWatcher (and PnpObject) can also look for other object types (e.g. containers).


    So if you use DeviceWatcher, in your callback you can fetch any property set on the interface specified by the DeviceInformation object that gets returned.


    This page has the list of canonical properties for all object types, and also shows how to specify properties using the GUID PID format:


    http://msdn.microsoft.com/en-us/library/windows/apps/hh465007.aspx


    Best Wishes - Eric

    Friday, May 25, 2012 5:22 PM
    Moderator
  • ok, thanks a lot for the answer, Eric!

    Jerry

    Monday, May 28, 2012 2:47 AM
  • You are most welcome Jerry.

    Best Wishes - Eric

    Tuesday, May 29, 2012 2:45 PM
    Moderator