Link to home
Start Free TrialLog in
Avatar of TheAvenger
TheAvengerFlag for Switzerland

asked on

Windows XP Style - Include the Manifest in the Executable

Hi Experts,

I am trying to implement Windows XP styles in my WinForm application. I followed closesly the instructions on http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dv_vstechart/html/vbtchUsingWindowsXPVisualStylesWithControlsOnWindowsForms.asp as well as some others. However there are still 2 open issues:

1. How can I include the manifest file in the executable AUTOMATICALLY and not manually after the build process?

2. How can I check if the executable contains the manifest itself so that I show Windows XP styles?

The above article in MSDN is somewhat wrong because it shows the way to include the manifest MANUALLY in the executable but in the code it is checked that the manifest exists as a separate file, which is not very clever.

The whole story with the manifest being aside makes setup projects very difficult to handle - now I cannot just say take the result of the original project and create a setup, I need to add also the manifest or to first manually add it in the exe...

Thanks for the help.
TheAvenger
Avatar of Sijin
Sijin

If you are using .Net Framework 1.1 you can set the EnableVisualStyles property of the application object to enable winxp styles. But you also will have to make all controls have FlatStyle = System.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemwindowsformsapplicationclassenablevisualstylestopic.asp

Avatar of TheAvenger

ASKER

The problem how to include the manifest file in the executable automatically is still interesting for me. However your solution Sijin solves my problem at the moment. So I will reward you points through a different question and leave this one open for more posts.

Please post an answer here so that I can accept it:
https://www.experts-exchange.com/questions/20799006/For-Sijin.html
You can use a post build action and/or a macro or add-in.
In the same article you mentioned initially there's a not to another article, which may be of help:

Creating a Visual Studio .NET Add-In to provide Windows XP Theme Support
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnperfmo/html/xpthemeaddin.asp?frame=true


BTW, even in .NET v1.1, do Application.DoEvents right after EnableVisualStyles. (this will solve some initialization issues that happen in some projects)

HTH
OK, this could be a solution (both actually, the post build action and the macro) but how shall it include the manifest in the exe? Is there a command prompt command that can include it (I can put command prompt commands only in the post build event)?
WiB: sounds just great but... it's for VC++ 6.0 and does not work for C# :-((
As you have seen above, I have read this link and it really works. But I have to do this MANUALLY every time I compile the executable and what I want is to include it AUTOMATICALLY. Can this be done at all?
ASKER CERTIFIED SOLUTION
Avatar of testn
testn

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
OK, this one worked. Thanks!