If you want your Win32 app to use the Windows XP visual style, all the information you need is in the MSDN article Using Windows XP Visual Styles. In case it isn't clear enough, here's what I did for my MASM32 application.
Create a manifest file
Create a new text file with the name you want (in my case, manifest.xml) and paste the following XML code:
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity
processorArchitecture="X86"
type="win32"
name="NameOfYourApp"
version="1.0.0.0" />
<description>Description of your app.</description>
<dependency>
<dependentAssembly>
<assemblyIdentity
processorArchitecture="X86"
type="win32"
name="Microsoft.Windows.Common-Controls"
version="6.0.0.0"
publicKeyToken="6595b64144ccf1df"
language="*" />
</dependentAssembly>
</dependency>
</assembly>
Replace NameOfYourApp and 1.0.0.0 with the name and version of your app. Also change the description to something more meaningful.
Include the manifest file
Just add these lines to your application's resource file:
#define CREATEPROCESS_MANIFEST_RESOURCE_ID 1
#define RT_MANIFEST 24
CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST DISCARDABLE "manifest.xml"
Make a few changes
Include comctl32.lib in your app:
INCLUDE C:\masm32\include\comctl32.inc
INCLUDELIB C:\masm32\lib\comctl32.lib
Call InitCommonControls anywhere in the code, just to put a reference to comctl32.dll so that it gets loaded. For example:
INVOKE GetModuleHandle, NULL
mov hInstance, eax
INVOKE DialogBoxParam, hInstance, IDD_MAINDLG, NULL, ADDR DialogProc, NULL
INVOKE ExitProcess, eax
INVOKE InitCommonControls
It'll never get executed, but it doesn't matter.
The result


Quite easy, wasn't it?
You can download my example app to see it for yourself: xp-stylin.zip (sources included).
Comments