SetupApiSetupDiGetClassDevs Method

Returns a handle to a device information set that contains requested device information elements for a local computer.

Definition

Namespace: DevCase.Win32.NativeMethods
Assembly: DevCase.net48 (in DevCase.net48.dll) Version: 6.0.0.0 (6.0)
XMLNS for XAML: Not mapped to an xmlns.
[DllImportAttribute("SetupApi.dll", CharSet = CharSet.Unicode)]
public static IntPtr SetupDiGetClassDevs(
	IntPtr classGuid,
	string enumerator,
	IntPtr hwndParent,
	SetupApiDeviceFiter flags
)

Parameters

classGuid  IntPtr
A pointer to the GUID for a device setup class or a device interface class.

This pointer is optional and can be Zero.

enumerator  String
A 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.

hwndParent  IntPtr
A handle to 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 Zero.

flags  SetupApiDeviceFiter
Flags that specifies control options that filter the device information elements that are added to the device information set.

Return Value

IntPtr
If the operation succeeds, 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 [ New IntPtr(-1) ].

To get extended error information, call GetLastWin32Error.

Remarks

See Also