Branding Control Panel with Bitmaps or Icons
In Windows XP and later versions of Windows, the sound application in Control Panel supports third-party branding of audio-device controls. Independent hardware vendors (IHVs) can display the following items next to the controls for their audio devices:
Proprietary device name
The INF file that installs the device driver also loads the Control Panel customization data into the registry. Bitmapped images of company logos are contained in the installed driver files themselves.
In Windows XP, branding information is visible to users in the following program locations:
The Volume page of the Sounds and Audio Devices application in Control Panel (Mmsys.cpl)
The SndVol32 program (Sndvol32.exe)
In Windows Vista, branding information is visible to users in the Playback and Recording pages of the Sound application in Control Panel (Mmsys.cpl).
The branding information is stored in the registry in a Branding subkey under the audio device's root key, which is located under the media-class key. The Branding subkey can contain one or more of the REG_SZ values that are shown in the following table.
Name of the file that contains the icon that is used by the SndVol32 control menu.
Name of the file that contains the 32-by-32 bitmap that is displayed in the Volume page of the Sound and Audio Devices application in Control Panel.
These values are added to the registry by directives within the add-registry-section (see INF AddReg Directive) of the INF file that installs the device driver. Control Panel uses defaults for any values that are missing from the Branding subkey.
The "bitmap" logo appears to the left of the proprietary device name at the top of the Volume page. The "icon" logo appears in the top-left corner of the SndVol32 control menu.
The proprietary device name that appears in the previously mentioned pages is the friendly name of the device. This friendly name is specified by a directive in the add-registry-section of the INF file that installs the device. This directive contains the keyword "FriendlyName", as shown in the example in INF AddReg Directive. In Windows XP, the Volume page and SndVol32 display only the first 31 characters of the name string. Longer strings are truncated. In Windows Vista and later versions of Windows, this 31-character restriction is removed when the device name is displayed in Control Panel. When you use APIs that were supported in versions of Windows earlier than Windows Vista, for example MCI_GetDevCaps, the 31-character limit still applies to the device name that you provide to the API.
The following example shows a couple of directives from the add-registry-section of a vendor's INF file:
[XYZ-Audio-Device.AddReg] HKR,Branding,icon,,"foo.sys,102" HKR,Branding,bitmap,,"c:\mydir\myimage.bmp"
These directives add control-panel branding information to the registry. HKR represents the audio device's root key in the registry; the Branding subkey is specified relative to the path name for the root key. The string value for the icon or bitmap key can be specified in one of two formats: "file,resourceid" or "imagefile". The first directive in the preceding example uses the "file,resourceid" format. The directive assigns to the icon key a string value that contains a file name, foo.sys, and a resource ID of 102. The file name and resource ID are separated by a comma (with no spaces). The file foo.sys contains the icon resource. The second directive in the preceding example assigns an "imagefile" formatted string to the bitmap key; the string contains the full path name of a .bmp file that contains the bitmap.
The example directive for the icon value can be changed to use the "imagefile" format, but in this case the string value should contain the path name of a file with an .ico file name extension.
In the case of the "file,resourceid" format, the control-panel software searches the same list of the search paths as the LoadLibrary function (described in the Microsoft Windows SDK documentation). If this path list does not contain the file, the software also searches the drivers directory (see INF DestinationDirs Section). This format allows the images to be easily stored in the driver file itself without requiring that absolute path names be specified in the INF file.
The following example applies to Windows Vista and later versions of Windows. This example shows a directive from the add-registry-section of a vendor's INF file. This example uses the "imagefile" format: