0
点赞
收藏
分享

微信扫一扫

SetupDiGetClassDevs介绍


函数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

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 .

举报

相关推荐

0 条评论