Archive

Posts Tagged ‘XP’

Windows XP SP3 released!

Categories: Announcements Tags: ,

Enable/Disable XP Visual Styles for your application

May 30, 2007 3 comments

Via resource editor

For VC6 add this one line to your .rc file, open it in a text editor….

CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST “YourAppName.exe.manifest”

YourAppName.exe.manifest should be your application’s manifest file.

Or you can paste YourAppName.exe.manifest to your application folder and XP themes gets enabled.

From VC8 onwards manifest file should only be in your res folder, which will be picked up by the resoource compiler.

Disable themes

To disable XP themes programmatically for a particular window call SetWindowTheme with last two parameters set to L””. E.g.

// Disables theme, I assume you have XP themes applied on your application
SetWindowTheme( GetSafeHwnd(), L"", L"" );

To disable themes systemwide call EnableThemes with it’s only parameter set to FALSE, be careful! you won’t be able to enable it back unless you belong to the TCB(Trusted computing base) group, SE_TCB_PRIVILEGE.

EnableThemes( FALSE ); // No more theming

Another way to disable theming for an application is to right click on the exe goto properties->Compatibility->Disable visual Themes. See this screenshot…

Disable themes

You’ve got some other options too on this page which you should try out. Useful to do some “minor” OS simulation work.

Interesting stuff

Another interesting thing to do is, you’ve noticed that msdev/VS6 doesn’t use XP themes so just rename YourAppName.exe.manifest to msdev.exe.manifest and paste in the msdev.exe parent folder. Restart msdev and see the difference, do the same with visual sourcesafe or any other application that doesn’t support xp themes. Have fun! 🙂

Note

Just incase you don’t have the manifest file with you, search in MSDN with RT_MANIFEST as key. Copy and paste the XML text that you see on the page to the manifest that’s mentioned above.

%d bloggers like this: