SetupApiSetupDiLoadDeviceIcon Method

Retrieves an icon for a specified device.

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", SetLastError = true)]
public static bool SetupDiLoadDeviceIcon(
	IntPtr deviceInfoSet,
	ref SetupApiDeviceInfo refDeviceInfoData,
	int width,
	int height,
	int flags,
	ref IntPtr refIcon
)

Parameters

deviceInfoSet  IntPtr
A handle to the device information set that contains the device information element that represents the device for which to retrieve an icon.
refDeviceInfoData  SetupApiDeviceInfo
A pointer to an SetupApiDeviceInfo structure that specifies the device information element in deviceInfoSet parameter.
width  Int32
The width, in pixels, of the icon to be retrieved.

Use the system metric index SM_CXICON to specify a default-sized icon or use the system metric index SM_CXSMICON to specify a small icon.

The system metric indexes are defined in Winuser.h, and their associated values can be retrieved by a call to the GetSystemMetrics function. (The GetSystemMetrics function is documented in the Microsoft Windows SDK.)

height  Int32
The height, in pixels, of the icon to be retrieved.

Use SM_CXICON to specify a default-sized icon or use SM_CXSMICON to specify a small icon.

flags  Int32
Not used. Must set to zero.
refIcon  IntPtr
A pointer to a handle to an icon that receives a handle to the icon that this function retrieves.

After the application that calls this function is finished using the icon, the application must call DestroyIcon(IntPtr) to delete the icon.

Return Value

Boolean
Returns if it succeeds in retrieving the icon for the specified device, or otherwise.

To get extended error information, call GetLastWin32Error.

Remarks

See Also