If I understood your question correctly I would recommend to you to use SetWindowTheme.
You should check out information provided with link above to see what docs.microsoft
(former msdn
) tells us in Remark
section:
When pszSubAppName and pszSubIdList are NULL, the theme manager removes the previously applied associations. You can prevent visual styles from being applied to a specified window by specifying an empty string, (L" "), which does not match any section entries.
So, having this in your mind you can easily restrict theming for any window those Handle
is known by calling SetWindowTheme
with both arguments set to "there should be whitespace between braces".
By the way I wouldn't highly recommend to kill themes for entire OS from your application. Personally, I delete any soft that has such a useful feature.
Important addendum!
I've read your question again after some time passed and I can answer to the first part of your question.
You can obtain theme's info via UXTheme
unit.
Primarily you must use this two functions:
- GetCurrentThemeName
- GetThemeDocumentationProperty
Here is some code that shows how to do this.
uses
..., UXTheme;
var
ThemeName: Array[0..512] of Char;
ThemeColorScheme: Array[0..512] of Char;
ThemeSizeName: Array[0..512] of Char;
PropertyName: Array[0..512] of Char;
begin
UXTheme.GetCurrentThemeName(@ThemeName, SizeOf(ThemeName), @ThemeColorScheme, SizeOf(ThemeColorScheme), @ThemeSizeName, SizeOf(ThemeSizeName));
UXTheme.GetThemeDocumentationProperty(@ThemeName, SZ_THDOCPROP_CANONICALNAME, @PropertyName, SizeOf(PropertyName));
end;
Please read about GetThemeDocumentationProperty
attentively - this function takes one of arguments that is in a charge of what property of OS theme will be return. According to docs.microsoft
, the flag SZ_THDOCPROP_CANONICALNAME
in the code above will return string property for
Retrieves the name of the theme.
So you will be able to check what theme is being using at the moment.
But you still can just disable themes for your own application.