This tutorial will teach you how to add an application manifest (a file used during the build process to specify a certain resource)
which specifies that Comctl32.dll (version 6) should be used if its available. Comctl32.dll is responsible for changing the
appearance of controls in your application.
Windows Xp ships with version 5 and version 6 of the same file. To get xp controls you need to bind the version 6 file with your
application, this binding is done with the help of the manifest file. A manifest file is just a simple xml file which is included in
your application.
Enough of this technical jargon, just tell me how to do it.
Create a new project.
1) Create a new project, we will call it "WindowsApplication1". Remember where you save it.
2) Now drag the following controls
Button
CheckBox
ProgressBar
RadioButton
StatusBar
3) Change the Button, Checkbox and RadioButton control's Flatstyle property to System.
4) Double click on the button and add the following code to its click event.
ProgressBar1.Value = 50
5) Your button's click event should look this.
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click ProgressBar1.Value = 50 End Sub
6) From the Build Menu, click on Build WindowsApplication1
7) Click on Save All from the file menu.
8) Dont close the Solution.
Making the Manifest
1) Go to your bin directory of your project where you will see your excutable.
2) Create a new text file in notepad with any name ( we will change the name later) in the same directory.
3) Copy, Paste the following code in the file. Incase you are lazy, download the file from the bottom of the page.
version="1.0.0.0" processorArchitecture="x86" name="MyApp" type="win32" /> type="win32" name="Microsoft.Windows.Common-Controls" version="6.0.0.0" processorArchitecture="X86" publicKeyToken="6595b64144ccf1df" language="*" /> 4) Click on save from the file menu. 5) Rename the file to "WindowsApplication1.exe.manifest"
without the double quotes. 6) If you get a warning which says "Are you sure you want to
change it?". Click on Yes. 7) Click on Start from the Debug Menu. Your application will be
in Xp style Controls. Click the button control to see the new look of the ProgressBar. If your application does not look like the one in Figure 2 then
you must have missed some step. Make sure you change the FlatStyle property of the controls to System. Building the Manifest into your Executable If you build your executable and give it to your friends, they
won't be able to see the Xp style controls, unless you pass the manifest as well. To solve this problem we need to build
the manifest in the executable. 1) In VB.Net select File -> Open -> File. Note - Save and close your previous solution first. 2) Find your executable you want to add the manifest to and
open it. 3) Right Click on WindowsApplication1.exe and click on Add
Resource. 4) Click on Import button in the Add Resource Dialog box. 5) Find the Manifest file we created earlier and open it. Note - If you cant find the file check "Files of Type" and
select All Files (*.*) 6) The Custom Resource Type dialog box will appear. Type
"RT_MANIFEST" (without quotes) in Resource Type: Click on OK. 7) Right click on 101 and select Properties. Set the following. ID = 1 Language = Neutral 8) Click on Save All from the File Menu. Conclusion With this simple tutorial we can now manipulate the appearance
of buttons, checkboxes and radiobuttons to look like those of Windows Xp. Now you can give the executable to all your friends without the
manifest file and it will still appear with Xp visual style. Note - This will work only on Windows Xp only because earlier
operating systems like Win 2000 and 98 cannot run Comctl32.dll. Your executable in those
operating system will look like default. If the theme in the Xp system is classic you wont be able to
see Xp style controls. About the author:
Sumedhk.com Click here to see the pics with the article. Articlewi
thpics