I\'m trying to call the OpenThemeData (see msdn OpenThemeData) function but I couldn\'t determine what are the acceptable Class names to be passed in by the pszClassList
I know this is an old question, but I want to give an updated answer (2018) for those who come here from Google.
The accepted answer of DavidK says to look into the file "AeroStyle.xml" where the themes are defined. This file was part of the Windows 7 SDK, but has been removed from the Windows 10 SDK, so the accepted answer is not useful anymore.
The answer of splash links to the MSDN where the list of theme names, parts and states is highly incompetlete and not updated.
The themes are drawn by UxTheme.dll which reads the images and colors, etc. from the file aero.msstyles in the folder C:\Windows\Resources\Themes\Aero
on Windows 10.
But when you open this file in a hex editor you will not find the names of all themes. I don't know if there is a way to enumerate all existing theme class names which can be passed to OpenThemeData()
. I suppose that this is not possible.
But what I know for sure is that in Windows 10 build 18282 Microsoft has removed the theme "Clock
" which is not used anymore and lots of undocumented themes have been added like for example: "TaskBand2CompositedSmallIconsVertical8Light::Taskband2
" which is passed as theme class name to OpenThemeData()
.
And I also know that several themes can only be obtained if you pass the correct window handle. If you pass the handle of the wrong window you may get another theme handle than expected or even NULL
.
I also know that Microsoft in the last 2 years internally has changed all their code to use OpenThemeDataForDpi()
instead of OpenThemeData()
because each monitor on Windows 10 may have a different resolution.
The problem that we have here is a severe lack of documentation in the MSDN and a lack of an API function to enumerate all availabe themes.
It has nothing to do with Aero, which even doesn't exits on XP ! See the source code of OpenThemeData()..
Class names depend on the theme. For example, as the documentation for OpenThemeData states:
Class names for the Aero theme are defined in AeroStyle.xml, which is found in the Include folder of the Microsoft Windows Software Development Kit (SDK).
The article Parts and States on MSDN contains a table which shows the control classes, parts, and states. The values in the table are defined in Vsstyle.h
and Vssym32.h
.
Here is a quick reference:
BUTTON, CLOCK, COMBOBOX, COMMUNICATIONS, CONTROLPANEL, DATEPICKER, DRAGDROP,
EDIT, EXPLORERBAR, FLYOUT, GLOBALS, HEADER, LISTBOX, LISTVIEW, MENU, MENUBAND,
NAVIGATION, PAGE, PROGRESS, REBAR, SCROLLBAR, SEARCHEDITBOX, SPIN, STARTPANEL,
STATUS, TAB, TASKBAND, TASKBAR, TASKDIALOG, TEXTSTYLE, TOOLBAR, TOOLTIP,
TRACKBAR, TRAYNOTIFY, TREEVIEW, WINDOW
The answer to the question Windows Visual Themes: Gallery of Parts and States? provides a "Parts and States Explorer" application where you can browse and test most of the styles.
You can look in "AeroStyle.xml" as a previous poster noted, which gives an exact list for Vista/Aero. However, if you want to play safe (and you probably do) the class names should, in general, be Windows class names of Windows common controls. For example, push buttons and check boxes use the class name "Button", the edit control "Edit", etc. I generally pick the class name of the control that's closest to whatever custom element I'm working on is, and use the theme data for that. That way you'll get code that works with XP, Vista and (hopefully) Windows 7, regardless of what the user's selected theme actually is.
However, unless you use raw Win32 a lot, you probably don't do much control creation directly using the class name. The class names are rather liberally sprinkled throughout MSDN. A good place to start is usually the "CommCtrl.h" file from the Platform SDK, which has a lot of them, and they're always described in the MSDN help on the individual common controls. You can also often learn them by looking at how dialogs are defined in .rc files by opening them in a text editor: these contain the class name for the controls.