tags:

views:

661

answers:

4

I want to allow my users to toggle the current user theme between Aero and Windows Classic(1). Is there any 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 any way of doing this?

The Application is hosted/run on a windows 2008 server 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.

A: 

I believe the best you can do is open your target .msstyles file (in c:\windows\resources\themes), which will pop up the display properties box. At this point you could use window subclassing to programmatically click the right buttons.

Factor Mystic
+5  A: 

You shouldn't even think about doing this. The Windows Theme Setting is a system-wide setting that the user should configure themselves. Applications should not change settings that affect every user on the system; that should be done using the appropriate functionality in the operating system's UI.

If you want to just change theme support in your own application, use the functionality available with an external manifest file and/or ThemeServices.

Ken White
1. I want to change it for the currently logged in user. 2. This is for a remote app (http://technet.microsoft.com/en-us/library/cc753844.aspx). I want to allow users to make the application they are running look like the other applications they have on their machines.
seanyboy
+3  A: 

You shouldn't.

Briefly, from the above, with my comments for context:

That's not something a program should be doing. Whether the Quick Launch bar [or, in this case, the Windows Theme -- it's the same principle - skeo] is shown or hidden is an end user setting, and programs should not be overriding the user's preferences... Much like the program that wants to uninstall other programs, the taskbar [Windows theme] would become a battleground among programs that each wanted to force themselves on and force their opponents off.

The user is the arbiter of what goes into the Taskbar [and similar system-wide settings].

Skeolan
Any link to Raymond gets +1 automatically.
Adam Mitz
A: 

These answers seem so stupid to me; the question was "how to..." not "is it ok...".

Think of this: somebody may want to expose (using a custom made app) lots of features that are currently hidden for the user wanting to customize a windows 7 theme. You may want also to hit an "apply theme" button instead of requiring the user to open other windows to do it.

If your theme comes as a themepack file double clicking it makes it automatically load - so that's your answer (just "run" it).

taka