What are the possible classes for the OpenThemeData function?

前端 未结 5 1251
鱼传尺愫
鱼传尺愫 2021-02-07 13:33

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

5条回答
  •  轮回少年
    2021-02-07 13:50

    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.

提交回复
热议问题