Go4Expert

Go4Expert (http://www.go4expert.com/)
-   MFC (http://www.go4expert.com/articles/mfc-tutorials/)
-   -   Windows XP Style controls in your MFC/WIN32 Applications (http://www.go4expert.com/articles/windows-xp-style-controls-mfc-win32-t754/)

shabbir 23Apr2006 15:19

Windows XP Style controls in your MFC/WIN32 Applications
 
1 Attachment(s)
This article will show you how you can convert all your applications from Windows 98 looks to the Windows XP looks. Its just too simple and does not require any code changes from the developers point of view. Other all things are expected to work as normal.

Note that MSDN requires you to call InitCommonControls by linking to ComCtl32.lib but I dont see any need for the same in the below mention process but if it doesn't work you can try it out. Try calling the function InitCommonControls in the initinstance of your application.

1. Just create a simple text file using any normal text editor like notepad and put the following content into the file and save it as ExeName.exe.manifest.
Code: XML

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity
    version="1.0.0.0"
    processorArchitecture="X86"
    name="CompanyName.ProductName.YourApplication"
    type="win32"
/>

<description>Your application description here.</description>
<dependency>
    <dependentAssembly>
        <assemblyIdentity
            type="win32"
            name="Microsoft.Windows.Common-Controls"
            version="6.0.0.0"
            processorArchitecture="X86"
            publicKeyToken="6595b64144ccf1df"
            language="*"
        />

    </dependentAssembly>
</dependency>
</assembly>

2. Go to the File Viewer window and add the ExeName.exe.manifest file to your workspace.
3. Add the following line into the RC fle of your application
CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST "ExeName.exe.manifest"

Note : Remember if you are using some other DLL's for the resources then you need to be adding the
CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST "ExeName.exe.manifest"
to each of the resouces dll as well as to the executables.

Sample output
Default them
http://www.go4expert.com/images/arti...ook/before.JPG

XP theme
http://www.go4expert.com/images/arti...look/after.JPG

The attached zipped file contains the source as well as the executable.

coderzone 24Apr2006 11:45

Re: Windows XP Style controls in your MFC/WIN32 Applications
 
Really nice article.

THRESHE 18Dec2006 19:13

Re: Windows XP Style controls in your MFC/WIN32 Applications
 
Thanks a lot. It's the only site where I've found this example :)

4688.ankit 27Sep2007 00:54

Re: Windows XP Style controls in your MFC/WIN32 Applications
 
attatched code(zip file) not working

shabbir 27Sep2007 10:23

Re: Windows XP Style controls in your MFC/WIN32 Applications
 
Quote:

Originally Posted by 4688.ankit
attatched code(zip file) not working

What seems to be not working?

4688.ankit 28Sep2007 00:44

Re: Windows XP Style controls in your MFC/WIN32 Applications
 
i opened the project in vc++ 6.0 .it ran successfully but the dialog box didn't have the XP look i.e the buttons,progressbars,etc were the same as they come normally in vc++ 6.0

shabbir 28Sep2007 04:42

Re: Windows XP Style controls in your MFC/WIN32 Applications
 
You should have the manifest variable defined. Try getting the value of it instead of the macro in the rc file.

johnsvakel 22Jan2008 17:04

Re: Windows XP Style controls in your MFC/WIN32 Applications
 
Nice article, very useful, thanx a lot :thinking:

alirizwan84 5Feb2008 15:59

Re: Windows XP Style controls in your MFC/WIN32 Applications
 
Well article is a good one and trick works but only for an MFC application.What about Win32 applications.I tried it in Win32 application but nothing happens.It works for Win32 application only if the manifest file is in the same folder in which the exe file is otherwise not.Plz tell how to embedd the manifest file directly in the Win32 application as u have done in ur MFC project.

shabbir 5Feb2008 18:22

Re: Windows XP Style controls in your MFC/WIN32 Applications
 
Did you try adding the manifest as a resource to the project in Win32


All times are GMT +5.5. The time now is 21:37.