Jump to content

[vb] Give Your App The XP Theme


Recommended Posts

Ever seen how programs designed for XP can have the xp theme that u have currently running?

Well due to the fact VB6 wasn't designed for making XP programs (due to the fact it was for 95/98 at the time).

So heres how it can be done two ways

First Way: Exe.Manifest

This is the easier way of making themes to work on your program.

For this example.. put a command button or two on the new project exe you started

place the follow declarations in:

Option Explicit
Private Declare Function InitCommonControls Lib "comctl32.dll" () As Long

This is declaring function for xp themes

Now to ensure this works, we need to make the program enable this by putting in code in the Form_Initialize event

Private Sub Form_Initialize()
   InitCommonControls
End Sub

And for the command button click event put:

Private Sub Command1_Click()
   Unload Me
End Sub

Ok now you can't see anything new if u run it in the IDE(intergrated development enviroment) so compile an exe to the desktop. Now if u run it it won't work.. why u say. because we haven't made the manifest file.

Simply open up notepad and input the following lines:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity type="win32" processorArchitecture="*" version="6.0.0.0" name="mash"/>
<description>Enter your Description Here</description>
<dependency>
  <dependentAssembly>
     <assemblyIdentity
          type="win32"
          name="Microsoft.Windows.Common-Controls" version="6.0.0.0"
          language="*"
          processorArchitecture="*"
        publicKeyToken="6595b64144ccf1df"
     />
  </dependentAssembly>
</dependency>
</assembly>

Save this file in the same directory as the exe and call it yourprogramname.exe.manifest

Now run and u'll find it will have taken the XP theme

Questions, comments etc are welcome :)

Link to comment
Share on other sites


is that the same to what ms did with the office 2003 and wont that mean only windows xp can use the program? 
i don't understand the first question.. but the xp theme added to program doesn't mean it can't be used on other windows os's.. all it does is if the os happens to be XP, it will allow to take the current theme on the program.. so it automatically skins it as such..
Link to comment
Share on other sites

  • 8 months later...
Listview headers and other components do not get theme look, just command button.  Any way to make all the components work or maybe just a few more?

depends what version of Microsoft Control u use.. version 5 is usually the one that has all of the controls themed..

Link to comment
Share on other sites

I can recommend that you embed the manifest file as a resource to your project, so it gets build inside the exe. Then you wont have to have a manifest file in your app folder.

My experince is that it also gives less problems.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...