在Windows 7/8中读取设备管理器的属性字段 [英] Reading Device Manager's Property Fields in Windows 7/8
问题描述
我正在开发一个Windows应用程序,该应用程序提供了字段详细信息-> X。
I am developing a windows application which gives the field details --> X.
其中X是->
右键单击我的电脑>
Properties >
Device Manager > (select any Item - Say KeyBoard) >
Click it > standard PS/2 KeyBoard >
double Click standard PS/2 KeyBoard >
click the Details Tab >
在物业下有各种字段,例如显示名称,问题代码,父母兄弟姐妹等?
Under the Property there are various fields like Display Name , Problem Code,Parent Siblings, etc , etc?
我想获取它们的值。
我可以使用哪个Windows API。
我正在Windows 7和Windows 8上执行此操作,希望API保持不变。我也有64位计算机。
这对于我想从设备管理器中了解其详细信息的任何设备都必须是正确的。
I want to get their values . Which Windows API I can use for this. I am doing this for windows 7 as well as windows 8.I hope the API will remain the same.Also i am having 64 bit machine. This has to be true for any device whose details I wanted to know from the Device Manager.
ALso我只想执行所有操作-读取和不设置(写作),因此我认为违反Admin Rights.PLease建议不会有任何问题。我添加了快照以供参考!例如,我想知道HID USB投诉鼠标的当前状态(D0(活动)或D2(睡眠))。
ALso I just want to all operations - Reading and No Set (writing) so I think I will not be having any problem with violating the Admin Rights.PLease suggest.! I have added Snapshots for reference!Say for example I want to know the current State of the HID USB Complaint Mouse(D0(Active) or D2(Sleep)).
我需要获取此电源状态D0。
I need to Get this Power State D0.
推荐答案
问题是用C#标记的,尽管实际的问题是要求提供任何Window API。使用Win32 API可以使用 SetupDiGetDeviceRegistryProperty()。步骤将是:
The question is tagged with C#, though the actual question asks for any Window API. With the Win32 API the information can be retrieved with SetupDiGetDeviceRegistryProperty(). The steps would be:
- 通过 SetupDiGetClassDevs()。
- 通过 SetupDiEnumDeviceInfo()。
- 通过调用SetupDiGetDeviceRegistryProperty()获取属性。
- 通过 SetupDiDestroyDeviceInfoList()。
- Get a device info set for the devices you're interested in via SetupDiGetClassDevs().
- Iterate through the device infos via SetupDiEnumDeviceInfo().
- Get the properties via calls to SetupDiGetDeviceRegistryProperty().
- Destroy the device info set via SetupDiDestroyDeviceInfoList().
根据文档,该API在Windows 2000及更高版本上可用。
According to the documentation the API is available on Windows 2000 and later.
这篇关于在Windows 7/8中读取设备管理器的属性字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!