Well, earlier today someone (no names!) asked me about getting XP style components into his project.
To my suprise, he was actually using Candy Buttons (or something) which he had downloaded off Planet Source Code.
He was using it to create XP styled components in his application.
I think the main use of Candy buttons was to be able to create your own styled Components, rather than using XP styled ones.
So, have you ever thought of having XP components in your application?
Of course you have. (and if not, you should have done after reading that
)
So, I am going to tell you how to not only have XP components in your .exe, but also how to enable it in
IDE!
First up,
IDE
To allow you to have all the default components (well, most) be shown during development using the XP style, you do not need to add something to everything you create.
No,
We are going to create a manifest file in the VB98 folder!
This will change the way VB is shown on your screen, like so!
Go to notepad,
Code:
<?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.YourApp"
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>
Save in the same directory as VB6.exe as,
Code:
vb6.exe.manifest
Now, that's better than ugly files been added to every project, more .dll dependencies and ugly modules, right?
Ooooh! Wow! It also changes the development bits, not just user-created components!
Ok. So everything you add into your project is now XP styled! Right?
Wrong!Only to the
developer.
The next bit will hardcode it into your project and make it appear like that to anyone who runs your application!
Code:
Private Declare Sub InitCommonControls Lib "comctl32.dll" ()
Private Sub Form_Initialize()
InitCommonControls
End Sub
What.. wait?
Is that
it?Actually, no it's not.
Unfortunately we need to add a dependency :(
Sowwy, but shit happens.
You'll need to make a new manifest file for every project you make!
Nothing too big, no massive code changes.
The same .manifest file you saved with VB6.exe, but you must rename the
Code:
VB6.exe
bit with the name of your .exe.
So if your .exe is called
Code:
xxxpron.exe
your manifest file will need to be
Code:
xxxpron.exe.manifest
Of course if you're clever (or lazy... or both actually..
) you can make a program do it for you!
So now your application looks sleek, smooth and... well... modern.