SetupDiGetClassDevs介绍

介绍了SetupDiGetClassDevs函数的功能及使用方法,该函数用于获取包含本地机器设备信息元素的集合句柄。详细解释了各参数的意义,如ClassGuid、Enumerator等,并提供了返回值说明。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

函数SetupDiGetClassDevs返回设备信息集合句柄,包括本地机器的设备信息元素。

函数原型为:

HDEVINFO SetupDiGetClassDevs( IN LPGUID ClassGuid..OPTIONAL, IN LPGUID Enumerator..OPTIONAL, IN HWND hwndParent..OPTIONAL, IN DWORD Flags );

Parameters
ClassGuid
A pointer to the GUID for a device setup class or a device interface class. This pointer is optional and can be NULL. For more information about how to set ClassGuid , see the following Comments section.
Enumerator
A pointer to a NULL-terminated string that specifies: <!-- -->
  • An identifier (ID) of a Plug and Play (PnP) enumerator . This ID can either be the value’s globally unique identifier (GUID) or symbolic name. For example, “PCI” can be used to specify the PCI PnP value. Other examples of symbolic names for PnP values include “USB,” “PCMCIA,” and “SCSI”.
  • A PnP device instance ID . When specifying a PnP device instance ID, DIGCF_DEVICEINTERFACE must be set in the Flags parameter.

This pointer is optional and can be NULL. If an enumeration value is not used to select devices, set Enumerator to NULL

For more information about how to set the Enumerator value, see the following Comments section.

hwndParent
A handle of the top-level window to be used for a user interface that is associated with installing a device instance in the device information set. This handle is optional and can be NULL.
Flags
A variable of type DWORD that specifies control options that filter the device information elements that are added to the device information set. This parameter can be a bitwise OR of zero or more of the following flags. For more information about combining these flags, see the following Comments section.
DIGCF_ALLCLASSES
Return a list of installed devices for all device setup classes or all device interface classes.
DIGCF_DEVICEINTERFACE
Return devices that support device interfaces for the specified device interface classes. This flag must be set in the Flags parameter if the Enumerator parameter specifies a device instance ID .
DIGCF_DEFAULT
Return only the device that is associated with the system default device interface, if one is set, for the specified device interface classes.
DIGCF_PRESENT
Return only devices that are currently present in a system.
DIGCF_PROFILE
Return only devices that are a part of the current hardware profile.
Return Value

If the operation succeeds, SetupDiGetClassDevs returns a handle to a device information set that contains all installed devices that matched the supplied parameters. If the operation fails, the function returns INVALID_HANDLE_VALUE. To get extended error information, call GetLastError .

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值