🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #5155

Re: Theming

#5155
From: nicolasr
Date: Mon, 26 Sep 2005 18:38
98 lines
4090 bytes
thanks for the reply. I tried to set up a test app and the results
are not as I expected. Here is the code:

void __fastcall TForm1::Button1Click(TObject *Sender)
{
   HINSTANCE mod = LoadLibrary("UxTheme.dll");
   if(mod)
   {
      typedef BOOL WINAPI (*PIsThemeActive)();
      typedef BOOL WINAPI (*PIsAppThemed)();

      PIsThemeActive IsThemeActive = (PIsThemeActive)GetProcAddress(mod, 
"IsThemeActive" );
      PIsAppThemed IsAppThemed = (PIsAppThemed)GetProcAddress(mod, 
"IsAppThemed");

      if(IsThemeActive && IsAppThemed)
      {
         BOOL res1 = IsThemeActive();
         BOOL res2 = IsAppThemed();

         if(res1 && res2)
         {
            //app is themed
         }
      }
   }

   FreeLibrary(mod);
}

Result: with or without manifest both functions return TRUE except for the 
case
when I use the properties dialog for the executable and disable visual 
styles on the
compatibility page.
I know there's nothing mentioned about this in the SDK docs but that is what 
I get here.

(I'm using BCB5 on XP-SP2 by the way)

I will also try the other way you suggested, GetModuleHandle() etc.

thanks again,
Nick


> "nicolasr" <nicolasrNOSPAMATSIGNgmx.net> wrote in message
> news:4335c6d1@newsgroups.borland.com...
>
>> IsAppThemed() indicates whether theming is enabled system wide.
>
> That is not correct.  According to MSDN:
>
>    "Reports whether **the current application's** user interface displays
> using visual styles."
>
>> IsThemeActive() tells whether theming is disabled for a
>> particular application via the program compatibility dialog.
>
> That is also not correct.  There is no dialog involved.  Also, like
> IsAppThemed(), it applies to the current application, not "a particular
> application", suggesting that you can query another application for its
> theming status, which you cannot.
>
>> These functions do, however, not tell me whether there is a manifest!
>
> If a manifest were not present, the functions would return FALSE since
> theming would not be enabled for the application in the first place.
>
>> Since the manifest could be embedded in the applications resources
>> it's not enough to simply check for the existence of a manifest file.
>
> You can check the application's resources directly for the presense of a
> manifest resource.
>
>> So, how could I tell whether the target application my
>> component (DLL) is running in is actually themed?
>
> Use IsAppThemed() and IsThemeActive().  If they both return TRUE than the
> application is actually themed.  If either returns FALSE then the
> application is not themed.  You don't have to do anything with the 
> manifest
> at all.  Although, if you still want to test for its presense, then you 
> can
> do the following:
>
> 1) use GetModuleFileName() to retreive the application's filename, append
> ".manifest" to it, and then check if that file exists.
>
> 2) use GetModuleHandle() to retrieve the HMODULE of the application that
> loaded the DLL, and then use that HMODULE to access the application's
> resources.
>
>
> Gambit
>
> 
Technical Details
Message-ID: <43383fd6@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <4335c6d1@newsgroups.borland.com> <4338331b$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,9f36dbae74e2f48b
X-Google-Attributes: gid10cc67,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: "nicolasr" <nicolasrNOSPAMATSIGNgmx.net>
Newsgroups: borland.public.cppbuilder.nativeapi
References: <4335c6d1@newsgroups.borland.com> <4338331b$1@newsgroups.borland.com>
Subject: Re: Theming
Date: Mon, 26 Sep 2005 20:38:58 +0200
Lines: 100
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
X-RFC2646: Format=Flowed; Original
NNTP-Posting-Host: 84.174.133.188
Message-ID: <43383fd6@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1127759830 84.174.133.188 (26 Sep 2005 11:37:10 -0700)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail