VS 2010 C++: How to create a manifest to enhance the GUI look?

Posted on 2011-10-27
Last Modified: 2012-05-12

I have a problem with creating and embeding the manifest file for the C++ native application for Windows in Visual Studio 2010 C++.  The problem is that when embeding my manifest, the application does not run on Windows XP mode of the Windows 7.  The executable cannot be launched at all.

The simplest possible application (that does not work for me after adding the manifest) is probably a message box with the OK button:

The message box with "old" GUI look -- see the OK button and around.
See the old look of the OK button and of the background around.  How can I add the manifest to make the button look the new way?

The testing example can be created this way:

1. Launch the Visual Studio 2010 C++.
2. Choose from the menu: File -- New -- Project... (Ctrl+Shift+N)
3. From the Installed Templates choose: Visual C++ -- Win32 -- Win32 Project
4. Choose the Location for the project, type-in the Name: test  (see the picture)

 Creating the new C++ project.
5. Press OK, Next >, and then check the Additional options: Empty project, and finally press the button Finish (see the image)

 Finishing the empty project.
6. In Solution Explorer, click the right mouse button over the Source Files -- Add -- New Item... (Ctrl+Shift+A)

 Add New Item...
7. ... select the C++ File (.cpp), give it the name main.cpp and press the Add button.

 Adding the main.cpp
8. Copy/paste the following code into the main.cpp.

#include <windows.h>

int WINAPI WinMain(HINSTANCE hInstance, 
                   HINSTANCE hPrevInstance, 
                   LPTSTR lpCmdLine, 
                   int nShowCmd)
    MessageBox(NULL, "test", "test", MB_ICONINFORMATION);
    return 0;

Open in new window

9. Now, open the Project -- test Properties... (Alt+F7), unfold the Configuration Properties, choose General and change the Character Set to the value "Not Set" and press OK (shown for Debug on the following picture, you can do the same for the Release if you want to compile also the Release version).

 Changing the Project properties...
10. Compile it (F7) and run it (F5) and you should see...

 The message box with "old" GUI look -- see the OK button and around.

Now, can you show how exactly should I add the manifest file and what should be its content?

Thanks for your time and experience,

P.S. I am using Windows 7 64-bit.
Question by:pepr
    LVL 30

    Accepted Solution

    Hi pepr,

    here you can find info about how to enable visual styles:

    One easy way mentioned there (which I usually use) is to add a pragma like this i.e. in 'stdafx.h':
    #pragma comment(linker,"\"/manifestdependency:type='win32' name='Microsoft.Windows.Common-Controls' version='' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"")

    Open in new window

    Hope that helps,

    LVL 28

    Author Comment

    Thanks Zoppo.  I will try in Monday.  Actually, had used the manifest earlier.  The problem is that I have discovered just recently that the application cannot be launched on Win XP (better to say in Win XP mode of the Win 7 virtual machine).  If interested, have a look at http:Q_27414344.html.

    The #pragma way is new to me.  Thanks again.
    LVL 28

    Author Comment

    I am loosing my last hairs.  Nothing from above works for me.  Can you recommend some full example sources to compile that include also the manifest.  The goal is to try if the GUI visual enhancement works in my environments.
    LVL 59

    Expert Comment

    I've requested that this question be deleted for the following reason:

    This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.
    LVL 28

    Author Comment

    Sorry for not closing the question earlier.  I feel that Zoppo's answer is correct and I have learned the #pragma version of doing that.  It simply seems that I have some problem with my environment or I have overlooked something.  I am planning to return to that later, but I did not find time, yet.

    LVL 28

    Author Comment

    Please accept the Zoppo's answer with A (fully understandable and easy to follow, from official documentation).  I cannot do it now as it is blocked.  
    LVL 28

    Author Closing Comment

    LVL 28

    Author Comment

    The problem was solved.  Have a look at http:Q_27563352.html if interested.

    Featured Post

    Threat Intelligence Starter Resources

    Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

    Join & Write a Comment

    Suggested Solutions

    Title # Comments Views Activity
    NTFS rights on WIndows 10 PRo 2 33
    Dual Monitor Issue 14 59
    Windows print sharing 1 38
    Arduino EDI - Programming language 3 31
    Image capture and Deploy method is consist on two phases. In our first phase we capture the image of windows from the PC in which Windows and others softwares are already installed. In second phase we deploy the created image on new PC in which we…
    First some basics on Windows 7 Backup.  It has 2 components one is a file based backup which is stored in .zip files each zip is split at around 200 Megabytes and there is the Image Backup which is as the name implies a total image of the partition …
    This Micro Tutorial will give you a introduction in two parts how to utilize Windows Live Movie Maker to its maximum capability. This will be demonstrated using Windows Live Movie Maker on Windows 7 operating system.
    The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

    734 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    20 Experts available now in Live!

    Get 1:1 Help Now