windowsthemes

How do I change the current Windows theme programmatically?


I want to allow my users to toggle the current user theme between Aero and Windows Classic(1). Is there a way that I can do this programatically?

I don't want to pop up the "Display properties", and I'm dubious about just changing the registry. (This requires a log out and a log back in for the changes to take effect).

Application skinning (using the Codejock libraries) doesn't work either.

Is there a way of doing this?

The application is hosted/run on a Windows Server 2008 over RDP.

(1) The application in question is a hosted "Remote App", and I want users to be able to change the look of the displayed application to match their desktop.


Solution

  • You can set it using the following command:

    rundll32.exe %SystemRoot%\system32\shell32.dll,Control_RunDLL %SystemRoot%\system32\desk.cpl desk,@Themes /Action:OpenTheme /file:"C:\Windows\Resources\Themes\aero.theme"
    

    Caveat is that this will show the theme selector dialog. You could kill that dialog straight after.