The SetupDiLoadDeviceIcon function retrieves an icon for a specified device.
WINSETUPAPI BOOL SetupDiLoadDeviceIcon( HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData, UINT cxIcon, UINT cyIcon, DWORD Flags, HICON *hIcon );
A handle to the device information set that contains the device information element that represents the device for which to retrieve an icon.
A pointer to an SP_DEVINFO_DATA structure that specifies the device information element in DeviceInfoSet.
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.)
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.
Not used. Must set to zero.
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 to delete the icon. (DestroyIcon is documented in the Microsoft Windows SDK.)
SetupDiLoadDeviceIcon returns TRUE if the function succeeds in retrieving the icon for the specified device. Otherwise, the function returns FALSE and the logged error can be retrieved by a call to GetLastError.
SetupDiLoadDeviceIcon attempts to retrieve an icon for the device as follows:
If the DEVPKEY_DrvPkg_Icon device property of the device includes a list of resource-identifier strings, the function attempts to retrieve the icon that is specified by the first resource-identifier string in the list.
The format of a resource-identifier string isWhere:
- filepath, followed by the backslash character ("\"), is optional and specifies a path of the file that contains the icon.
- FileName, followed by the comma character (",") specifies the name of the file that contains the icon.
- ResourceID, preceded by a dash character ("-"), specifies the resource ID of the icon.
- If the function cannot retrieve a device-specific icon, it will then attempt to retrieve the class icon for the device. For information about class icons, see SetupDiLoadClassIcon.
- If the function cannot retrieve the class icon for the device, it will then attempt to retrieve the icon for the Unknown device setup class, where the icon for the Unknown device setup class includes the image of a question mark (?).
|Windows version||Available in Windows Vista and later versions of Windows.|
|Header||setupapi.h (include Setupapi.h)|