Reputation: 8801
How do you query the status of all detected devices?
Where devices are USB connected hardware ( cameras, credit card readers ), PCI bus connected hardware, or hard drives. Anything that can show up as errored in the Device Manager is of interest.
Upvotes: 1
Views: 126
Reputation: 13950
WMI works, but it's pretty slow and there are a lot of moving parts to go wrong. If you need faster/more reliable access, try the SetupDI APIs (see this). pinvoke.net can get you started with the C# declarations.
Upvotes: 1
Reputation: 9566
While I've never tried it before, I think what you want to use is WMI: Windows Management Instrumentation. Specifically, you should look at the System.Management namespace.
Here's a tutorial I found that shows you how to query for hard drives connected to a system, and also how to query for running processes: --> http://msdn.microsoft.com/en-us/library/system.management.aspx
Let me know if this helps. I've considered using WMI before for simple windows management tasks, but I've always ended up using simple registry scripts instead.
Upvotes: 0