Share via


How to Specify an Icon for a Device

Devices and device handlers should always have associated icons to meet minimum usability requirements. This topic describes how to specify icons for devices.

Instructions

To specify an icon for a device, under the DeviceParameters key of the device instance, add a value named Icons as type REG_MULTI_SZ. The data entry for this value is the path to the file that contains the default icon.

A separate value is defined for NoMediaIcons, which specifies a parallel set of device icons that is used to indicate the same device when no media is inserted. If more than one icon source is provided in the Icons value, the data entries in NoMediaIcons should be listed in the same order so that each icon under Icons has a corresponding entry under NoMediaIcons.

The following example shows an entry for a Vid_059&Pid_0031 device and DLL files that contain the "media inserted" and "no media" versions of the icon.

  HKEY_LOCAL_MACHINE
   SYSTEM
      CurrentControlSet
         Enum
            USB
               Vid_059b&Pid_0031
                  059B003112010E93
                     Device Parameters
                        Icons [REG_MULTI_SZ] = %SystemRoot%\system32\mydll.dll,-103
                        NoMediaIcons [REG_MULTI_SZ] = %SystemRoot%\system32\mydll.dll,-104

The numeric value following the name of the binary file (such as Mydll.dll in the example) is the index of the icon in that binary file if the value is zero or greater, or it is the icon resource ID if negative (as in the example). An .ico file does not require a value.

Remarks

You can provide more than one icon, listed in order of preference with the preferred icon first, but Windows XP uses only the first icon.

You can assign icons by using device group or device class settings.

 

 

Send comments about this topic to Microsoft

Build date: 9/7/2011