Jump to content

How to make theme change active


Recommended Posts

I know how to change the active theme, but, normally, the change won't take affect until either the system is rebooted, the user logs off/on, or explorer.exe (the 'base') is ended/restarted.

We are using Au3 to detect which server is consdiered the primary/active server, and change the desktop themes (color schemes) dynamically, so the admins know from glancing at a server's desktop if that system is or is not active.

(i know there are numerous other ways to 'notify' the admins, but this is the way agreed on/approved of.

I know there has to be a way to make the change take affect WITHOUT bringing up the display properties and clicking APPLY/OK; like a dll call or something.

Does anyone know how to do this?

Thanks,

Van

Link to comment
Share on other sites

I know how to change the active theme, but, normally, the change won't take affect until either the system is rebooted, the user logs off/on, or explorer.exe (the 'base') is ended/restarted.

We are using Au3 to detect which server is consdiered the primary/active server, and change the desktop themes (color schemes) dynamically, so the admins know from glancing at a server's desktop if that system is or is not active.

(i know there are numerous other ways to 'notify' the admins, but this is the way agreed on/approved of.

I know there has to be a way to make the change take affect WITHOUT bringing up the display properties and clicking APPLY/OK; like a dll call or something.

Does anyone know how to do this?

Thanks,

Van

<{POST_SNAPBACK}>

i'm pretty sure it's in the registry... double checking for the exact key right now... windows 2k/xp?
Link to comment
Share on other sites

i'm pretty sure it's in the registry... double checking for the exact key right now... windows 2k/xp?

<{POST_SNAPBACK}>

check out HKEY_CURRENT_USER\Control Panel\Desktop\ in the registry, i don't see an item in there for theme, but you can change the "Wallpaper" item to change the wallpaper... should only take a second to update that to whatever wallpaper is being used as a signal...
Link to comment
Share on other sites

check out HKEY_CURRENT_USER\Control Panel\Desktop\ in the registry, i don't see an item in there for theme, but you can change the "Wallpaper" item to change the wallpaper... should only take a second to update that to whatever wallpaper is being used as a signal...

<{POST_SNAPBACK}>

The wallpaper was considered earlier on, but the change being dynamic (hopefully) wouldn't inform someone working on that system of the change if the wallpaper wasn't actually visisble ( i.e. program window was maximized). Hence, we chose the them itself, so it is very apparent of the change in status.

Also, the change to the wallpaper is the same, in that the change will not take affect until the same conditions as listed in my original posting.

Van

Edited by van_renier
Link to comment
Share on other sites

I know how to change the active theme, but, normally, the change won't take affect until either the system is rebooted, the user logs off/on, or explorer.exe (the 'base') is ended/restarted.

We are using Au3 to detect which server is consdiered the primary/active server, and change the desktop themes (color schemes) dynamically, so the admins know from glancing at a server's desktop if that system is or is not active.

(i know there are numerous other ways to 'notify' the admins, but this is the way agreed on/approved of.

I know there has to be a way to make the change take affect WITHOUT bringing up the display properties and clicking APPLY/OK; like a dll call or something.

Does anyone know how to do this?

Thanks,

Van

<{POST_SNAPBACK}>

i found something for you that may help. it is possible to change the theme using a function in the uxtheme.dll file. i'm on 2000 here at work so i can't write/test here, but this should be enough to help you i hope.

SetWindowTheme Function

--------------------------------------------------------------------------------

Causes a window to use a different set of visual style information than its class normally uses.

Syntax

HRESULT SetWindowTheme(          HWND hwnd,

    LPCWSTR pszSubAppName,

    LPCWSTR pszSubIdList

);

Parameters

hwnd

[in] Handle to the window whose visual style information is to be changed.

pszSubAppName

[in] Pointer to a string that contains the application name to use in place of the calling application's name. If this parameter is NULL, the calling application's name is used.

pszSubIdList

[in] Pointer to a string that contains a semicolon-separated list of class identifier (CLSID) names to use in place of the actual list passed by the window's class. If this parameter is NULL, the identifier (ID) list from the calling class is used.

Return Value

Returns S_OK if successful, or an error value otherwise.

Remarks

The theme manager retains the pszSubAppName and the pszSubIdList associations through the lifetime of the window, even if visual styles subsequently change. The window is sent a WM_THEMECHANGED message at the end of a SetWindowTheme call, so that the new visual style can be found and applied.

When pszSubAppName and pszSubIdList are NULL, the theme manager removes the previously applied associations. To prevent visual styles from being applied to a specified window, pass an empty string, (L" "), which will not match any section entries.

Function Information

Stock Implementation UxTheme.dll

Custom Implementation No

Header uxtheme.h

Import library UxTheme.lib

Minimum operating systems Windows XP

ok, so you can use the SetWindowTheme() from uxtheme.dll with the dll functions in autoit. and according to the remarks, after you use that function, it sends a message to your window to let it know that the theme is changed and to update it. if you can implement this, should do exactly what you want it to.
Link to comment
Share on other sites

  • 2 weeks later...

Great... Thanks. I'll definitely take a look at this.

(Although I'm skeptical of it working as expected, I'm optimistic (hopefully) of it doing exactly what I need.)

Thanks for your time, research, and input!

Van

i found something for you that may help.  it is possible to change the theme using a function in the uxtheme.dll file.  i'm on 2000 here at work so i can't write/test here, but this should be enough to help you i hope. 

ok, so you can use the SetWindowTheme() from uxtheme.dll with the dll functions in autoit. and according to the remarks, after you use that function, it sends a message to your window to let it know that the theme is changed and to update it.  if you can implement this, should do exactly what you want it to.

<{POST_SNAPBACK}>

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...