Hi there,
the IsThemeActive call of uxtheme.dll always returns 'False' in build 5270, no matter whether themes are active, or not.
Hope this is the right forum to post this, since I did not find any 'Report bugs' forum ...
:)
Thanks,
Steve

IsThemeActive call (uxtheme.dll) not working properly in 5270
keram
When my testproject to check whether or not a theme is active is compiled to 'Native code', then the 'IsThemeActive' function always returns 'False'. When I compile it to 'P-Code', then it works fine.
In debug mode the function works fine at all times, but once compiled, it must be compiled in 'P Code', otherwise the IsThemeActive fails.
Do I have to understand that
Here's the code - if someone wants to try it ... And maybe this can be forwarded to the appropriate people ...
Private Declare Function IsThemeActiveAPI Lib "uxtheme.dll" Alias "IsThemeActive" () As Boolean
Public Function GetThemeActive() As Boolean
isAct = IsThemeActiveAPI()
If isAct = True Then
GetThemeActive = True
Else
GetThemeActive = False
End If
End Function
Sub Main()
Dim isThemed As Boolean
isThemed = GetThemeActive
MsgBox isThemed
End Sub
Heath Stewart MSFT
But actually I do not see any major difference between your call, and the one I used below in VB6, and it worked great on XP, but fails on 5270 for some reason - no error returned, just getting a 'False' everytime:
Private Declare Function IsThemeActiveAPI Lib "uxtheme.dll" Alias "IsThemeActive" () As Boolean
(as listed on http://msdn.microsoft.com/library/default.asp url=/library/en-us/shellcc/platform/commctls/userex/functions/isthemeactive.asp)
Additionally, the 'GetCurrentThemeName' call of the same .dll does not return anything, either ...
Anyway - thanks for your help.
:)
Steve
Dylan Ngo
Hi, Steve.
I made a quick update to one of my theme aware apps and tested under 5270. This app runs under legacy platforms, so the theme calls are run-time dynamic link. Here's the code I tested:
if (nWinVer >= 5)
{
BOOL bThemeActive;
HMODULE hUxTheme;
hUxTheme = LoadLibrary ("uxtheme.dll");
if (hUxTheme != 0)
{
lpfnIsThemeActive =
(PFNITA)GetProcAddress (hUxTheme, ITA_NAME);
bThemeActive = lpfnIsThemeActive ();
Running under build 5270, the bThemeActive result is returning TRUE on my computer.
sat8003
Hmmm.... Maybe I will learn something here, too. I never use the IsThemeActive API call in my own code. I just call OpenThemeData and see if I get a valid or NULL handle returned.
Is that "doing-it-the-wrong-way"...