Windows – How to select a theme programmatically in Vista


A software package I'm working on installs its own Windows theme and as part of the install tries to make it the current theme. We managed to get this working on Windows XP with a great many registry edits during the install (a reboot applies the changes) but Vista seems to require even more reqistry changes.

We also found that "running" the theme file will open the Themes dialog and select the theme but a user needs to click OK. A script could accomplish this, true, but finding the OK button on non-English Windows is a challenge I'd rather not have to address.

So, is there a way to programmatically change the current theme in Windows Vista?

Best Solution

Sorry to necro an old thread, but I still see this question around the internets.

Windows is still not very far removed from its DOS roots. You can shell this command to open the control panel and load your theme.

This works for Windows 7, but can be modified for Vista. Just shell this, or type it into a command window:

C:\Windows\system32\rundll32.exe C:\Windows\system32\shell32.dll,Control_RunDLL C:\Windows\system32\desk.cpl desk,@Themes /Action:OpenTheme /file: SomeDir\themename.themepack

Basically, just use rundll32 to run the control panel, and then feed it your theme. You will get a control panel dialog pop up, but the theme will install automatically.

If you want it to install a theme without a dialog popup, you are going to need to do the massive registry hack.