-1

I'm using the SetupDi... functions to enumerate HID devices.

If I'm looking at these devices in the windows settings, they have nice hi-res icons (photos). I'm looking for the API to receive those.

I've tried SetupDiLoadDeviceIcon, but the result is underwelming:

hid device icon

This is when I request a 100x100 icon. I've tried larger and smaller sizes as well.

Here's the code I'm using (somewhat simplified, iterating through index gives all HID devices):

 GUID guid;
 HidD_GetHidGuid(&guid);
 device_info_set = SetupDiGetClassDevs(guid, 
                   NULL, NULL, 
                   DIGCF_PRESENT|DIGCF_DEVICEINTERFACE);
 SP_DEVINFO_DATA dev_info;
 SetupDiEnumDeviceInfo(device_info_set, index, &dev_info);

 SetupDiLoadDeviceIcon(device_info_set, 
                       dev_info,
                       100, 100, 
                       0,
                       &hicon);

This is the small icon used in the device manager (missing the alpha mask). How can I get the pretty ones?

Just to be clear, these are kind of icons / images I'm looking for. The logitech HID device, for example, is not a stock picture:

screenshot

Stefan
  • 4,187
  • 1
  • 32
  • 38

1 Answers1

1

After calling SetupDiGetClassDevs+SetupDiEnumDeviceInfo and requesting a 256x256 icon from SetupDiLoadDeviceIcon I'm given a icon that is 256x256 pixels in size but it has clearly been resized because the quality is horrible.

GetIconInfoEx tells me the icon has been loaded from setupapi.dll and that library only contains 16x16, 32x32 and some 48x48 device icons. This does not apply to all devices, some are able to deliver a high quality icon.

If you want high quality generic device icons you can use SHGetStockIconInfo.

Anders
  • 97,548
  • 12
  • 110
  • 164
  • These are not the icons I'm looking for. I'm looking for the ones provided by the manufacturer. – Stefan Sep 24 '17 at 17:39
  • You can try getting the DEVPKEY_DrvPkg_Icon property directly, it should come from the device without a fallback icon. – Anders Sep 24 '17 at 20:23