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.
Right-click in any blank space on the desktop. Select Personalize from the drop-down menu that appears. On the left side, select Themes, and then Theme settings. In the Personalize window that appears, click the Get more themes online option.
Go to Settings > Accounts > Sync your settings. From the right-hand pane, select Individual sync settings. Toggle the Theme setting to off. That's all there is to it!
Please be informed that there is no option to edit themes in Windows 10. How ever you can create your own theme using your favorite photos. Also you can use your favorite web browser and search for any theme creator program which can help you edit the themes.
%localappdata%\Microsoft\Windows\Themes Press the Enter key to open the Themes folder. Step 2: The Themes folder contains all installed themes. You can double-click on a theme's folder to see the desktop theme file as well as the Desktop Background folder which includes all the wallpapers of that theme.
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.
There are certainly good reasons for wanting to change the current theme programmatically. E.g. an automated test tool may need to switch between various themes to make sure the application works correctly with all of them.
As a user, you can change the theme by double-clicking a .theme
file in Windwos Explorer and then closing the Control Panel applet that pops up. You can easily do the same from code. The steps below work just fine for me. I've only tested on Windows 7.
SHGetKnownFolderPath()
to get the "Local AppData" folder for the user. Theme files are stored in the Microsoft\Windows\Themes
subfolder. Theme files stored there are applied directly, while theme files stored elsewhere are duplicated when you execute them. So it's best to use files from that folder only.ShellExecute()
to execute the .theme
file you located in step 1.FindWindow('CabinetWClass', 'Personalization')
to get the handle of the Control Panel window that popped up when the theme was applied. The "Personalization" caption will likely be different on non-US-English versions of Windows.PostMessage(HWND, WM_CLOSE, 0, 0)
to close the Control Panel window.This isn't a very elegant solution, but it does the job.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With