问题描述
大家好,
我正在使用的系统是Windows XP。
我是试图用C语言中的程序检测设备的状态(例如此设备无法启动(代码 10 )或此设备已停用(代码 22 ))。
我正在使用setupapi获取计算机上所有外围设备的列表。我尝试了使用SPDRP_INSTALL_STATE的SetupDiGetDeviceRegistryProperty函数,但也许我的方法是错误的。
有谁知道如何完成这项工作?任何代码示例都会很棒。
对不起我的英语我有点生疏。
感谢您的帮助。
Hi everyone,
The system I am working on is Windows XP.
I am stuck trying to retrieve the state of a device with a program in C (such as this device cannot start (code 10) or this device is desactivated (code 22)).
I am using the setupapi to get the list of all the peripheral on my computer. I tried the SetupDiGetDeviceRegistryProperty function with SPDRP_INSTALL_STATE but maybe I am doing it the wrong way.
Has anyone an idea on how I can get this done? Any code example would be great.
Sorry about my English I am a bit rusty.
Thank you for your help.
推荐答案
CM_Get_DevNode_Status(&Status, &Problem, DeviceInfoData.DevInst, 0)
使用函数SetupDiEnumDeviceInfo检索DeviceInfoData.DevInst的位置。
然后可以在变量Problem中读取设备错误代码。
Where DeviceInfoData.DevInst is retrieved by using the function SetupDiEnumDeviceInfo.
The device error code can then be read in the variable Problem.
这篇关于如何检索外围设备的状态的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!