Home > C++, VC++ > Enable/Disable XP Visual Styles for your application

Enable/Disable XP Visual Styles for your application

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.

Advertisements
  1. Bogdan
    March 16, 2009 at 6:13 pm

    XP and 2000 but I decided to use the StuckRects2 registry key to do the job. It works fine too.
    Tnx.

  2. Bogdan
    March 9, 2009 at 5:22 pm

    Hi man! Cool stuff u have! Man I see you’re good in winAPI stuff… Can u help me with something?
    I’m trying to do a internet cafe software, and I need to AUTOHIDE TASKBAR or uncheck ON TOP OF OTHER APPS. I searched the whole www but I found nothing just hiding it. It is possible to help me with this one ? 😦 pls… tnx.. 😦

    • March 16, 2009 at 3:38 pm

      What’s the operating system that you are working on?

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: