XP manifest files
Tuesday, 27 September 2005
Even though Windows XP supports skinnable interfaces, Visual Basic 6 applications will not automatically inherit the new look and feel. This is not surprising, considering VB6 has been around long before Windows XP came out. What is surprising though, is that your VB.NET applications also will not automatically inherit the new look.
However, making your buttons, textboxes and other controls look like they were designed for Windows XP is not only possible, it’s pretty easy too. The Microsoft API allows this via the use of an XML “manifest” file and a little bit of simple coding.
Firstly, create a manifest file that looks like this:
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1"
manifestVersion="1.0">
<description>Windows forms common control manifest</description>
<dependency>
<dependentAssembly>
<assemblyIdentity type="win32"
name="Microsoft.Windows.Common-Controls"
version="6.0.0.0" processorArchitecture="x86"
publicKeyToken="6595b64144ccf1df" language="*" />
</dependentAssembly>
</dependency>
</assembly>
Save the manifest file, with a “.manifest” extension, in the same directory where the application executable lives. For instance, if your application is called “magarac.exe”, then the correct manifest file name would be “magarac.exe.manifest”
Secondly, depending on whether you’re using VB.NET, or Visual Basic 6:
In VBN, you must change the flatstyle property of every button, checkbox, groupbox, radio and label from the default “standard” to “system”.
In VB6, you must initialise the common controls (via an API call) for every form, before the form becomes visible:
Private Declare Function InitCommonControls _
Lib "Comctl32.dll" () As Long
Private Sub Form_Initialize()
InitCommonControls
End Sub
You can even incorporate a manifest file in your IDE. Just create it as one of the following:
- VBN: C:\Program Files\Microsoft Visual Studio .NET 2003\Common7\IDE\devenv.exe.manifest
- VB6: C:\Program Files\Microsoft Visual Studio\VB98\vb6.exe.manifest
Of course, that’s assuming you’ve installed your IDE in those directories. The main thing to remember is that the manifest file must be in the same directory as the application executable.
For an in-depth look at skinning under Windows XP, see Using Windows XP Visual Styles.
|
Thank you for making this information more available. What you may also want to say is that skinning a VB6 application doesn't work when the program is run from the IDE (Visual Studio). You need to compile the program and run it without using the IDE to see any skin.
Brian Hauk
Brian,
What I meant by my "You can even incorporate a manifest file in your IDE" statement is exactly that if you create a "vb6.exe.manifest" file in the same directory where "vb6.exe" resides, then any project you run from the IDE will inherit the XP style. Are you saying that you've tried it yourself and it doesn't work for you?
I was just putting some application together (VB) and wondered how this was possible for my customer on their Windows Xp machines. Now I know. Thanks for information. However, I have question. Which of the standard controls which come from Microsoft can be skinned this way?
From what I can gather the following (Microsoft) controls are able to be styled:
ComboBox, ContextMenu, DataGrid, DateTimePicker, DirListBox, DriveListBox, FileListBox, Frame, HScrollBar, ListBox, ListView, MainMenu, MonthCalendar, OptionButton, ProgressBar, RichTextBox, Splitter, StatusBar, TabControl, TextBox, ToolBar, TrackBar, TreeView and VScrollBar.
You can expect problems with some third-party controls (like Sheridan/Infragistics) however, so you'll need to investigate this for yourself.
Hi Abbey,
Thank you for your reply.
I commented that skinning is not visible within the VB6 development environment so that no one will expect it unless they have created the “vb6.exe.manifest” file as you explain.
Brian Hauk
Hi Ivan,
Thanks for your valuable information. Manifesting the executable file was successful after following your steps. Now, I would like to do that to a dll file. May I know what are the correct manner to carry out for a dll file. I have tried some of the example shown in the website, but is still a failure.
Thanks in advance, Ed