Categories: MSDN / DotNet / Java / Scripts / Linux / PHP Ask - La ask - La Answer

Adding Windows XP Styles 2 Ur Application

First of all :
What is meant by Windows XP Styles ?

to understand what is meant by Windows XP Styles Look at the first attatched picture :

to do that you must have this code in your project :

Private Declare Function GetVersionEx Lib "kernel32" Alias "GetVersionExA" (lpVersionInformation As OSVERSIONINFO) As Long
Private Declare Function InitCommonControlsEx Lib "comctl32.dll" (init As InitCommonControlsExType) As Boolean

Private Type InitCommonControlsExType
dwSize As Long 'size of this structure
dwICC As Long 'flags indicating which classes to be initialized
End Type

Private Type OSVERSIONINFO
dwOSVersionInfoSize As Long
dwMajorVersion As Long
dwMinorVersion As Long
dwBuildNumber As Long
dwPlatformId As Long
szCSDVersion As String * 128
End Type
Private Function InitCommonControls() As Boolean
Dim InitCC As InitCommonControlsExType

With InitCC
.dwSize = Len(InitCC)
.dwICC = ICC_USEREX_CLASSES
End With

InitCommonControls = InitCommonControlsEx(InitCC) 'initialize the common controls
End Function

Private Sub Form_Initialize()
Dim os As OSVERSIONINFO
os.dwOSVersionInfoSize = Len(os)
GetVersionEx os
If os.dwMajorVersion >= 5 Then InitCommonControls
End Sub

Note :
Skip the previous step if the startup form has already a common-controls control such as progress bar

Then ,
use the attached XP Styler program to add XP Styles to your programs

XP Styler can be used also as An ADD-In to make your application "XP-Styled " automatically on compile !

You can make VB6 itself XP-Styled !

Now Enjoy your XP Styled Program !!
[1878 byte] By [amrelsaqqa] at [2007-11-11 10:17:33]
# 1 Re: Adding Windows XP Styles 2 Ur Application
Thanks Amr .

p.s. I knew another method , that add an xml file (mainfeast file) in the project resource .. the xml string is easy to be done , and I prefere it than using a closed exe package :)
p.s.s in the online msdn there is steps in how to implement this xml .
Amahdy at 2007-11-11 17:22:53 >
# 2 Re: Adding Windows XP Styles 2 Ur Application
Thank U amahdy,
I understood what do u mean , this tool adds an internal or external manifest file to your application

manifests can be added by using 2 methods :
standalone manifest file named as your application.exe.manifest ( I don't like this )

the other method is to add it to the application's resources in a "24" resource entry .

The manifest file or resource looks like this :

<?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="MyApp"

type="win32"

/>

<description>MyApp</description>

<dependency>

<dependentAssembly>

<assemblyIdentity

type="win32"

name="Microsoft.Windows.Common-Controls"

version="6.0.0.0"

processorArchitecture="X86"

publicKeyToken="6595b64144ccf1df"

language="*"

/>

</dependentAssembly>

</dependency>

</assembly>

the work of my tool is to automate adding the resource on compile .

instead of using another resource viewer or using BeginUpdateResource function
amrelsaqqa at 2007-11-11 17:23:53 >