Theme names under XP

Theme names under XP

Postby Maurilio Viana » Tue Mar 14, 2006 10:20 pm

Is possible to detect XP theme names?
I think paint the background color of outlook class based on XP theme (blue, silver or green...).

Regards,
Maurilio
User avatar
Maurilio Viana
 
Posts: 252
Joined: Tue Oct 25, 2005 2:48 pm
Location: Garça/Garza/Heron City - Brazil

Postby James Bott » Wed Mar 15, 2006 8:38 pm

Maurilio,

The answer is supposedly here:

http://www.codeproject.com/csharp/xptheme.asp

It shows how to read this information from the registry. However, the key, ColorName, that it says holds the theme color, doesn't exist in my registry (and I am using themes). So, I don't know the anwser.

James
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: Theme names under XP

Postby Enrico Maria Giordano » Wed Mar 15, 2006 9:40 pm

The API is GetCurrentThemeName() but I don't know how to use it as it requires wide chars strings.

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8710
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Postby Maurilio Viana » Thu Mar 16, 2006 2:06 pm

Thanks, James and Enrico.

I´ll try any about it.
If I have success I´ll publish here.

Regards!
Maurilio
User avatar
Maurilio Viana
 
Posts: 252
Joined: Tue Oct 25, 2005 2:48 pm
Location: Garça/Garza/Heron City - Brazil

Postby Maurilio Viana » Fri Mar 17, 2006 11:21 pm

Here a single function to detect XP theme name

return:
"WindowsClassic" if no theme is used
"XPBlue" if theme is blue
"XPGreen" if theme is olive green
"XPSilver" if theme is silver

Code: Select all  Expand view

#define  HKEY_CURRENT_USER       2147483649

function CurrentTheme()
local cTheme   := "WindowsClassic"
local cKeyName := "Software\Microsoft\Windows\CurrentVersion\ThemeManager\"

oReg := TReg32():New( HKEY_CURRENT_USER, cKeyName )
if oReg:nError == 0
    cTheme := StrTran( oReg:Get("ColorName", ""), chr(0),"")
    do case
       case cTheme == "NormalColor" ; cTheme := "XPBlue"
       case cTheme == "HomeStead"   ; cTheme := "XPGreen"
       case cTheme == "Metallic"    ; cTheme := "XPSilver"
       otherwise                    ; cTheme := "WindowsClassic"
    endcase
endif
oReg:Close()
return( cTheme )
User avatar
Maurilio Viana
 
Posts: 252
Joined: Tue Oct 25, 2005 2:48 pm
Location: Garça/Garza/Heron City - Brazil


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Rick Lipkin and 85 guests