Powerbasic Museum 2020-B

Webmaster: José Roca (PBWIN 10+/PBCC 6+) (SDK Forum) => Windows API Programming => Topic started by: José Roca on August 29, 2011, 06:35:41 PM

Title: Visual Styles
Post by: José Roca on August 29, 2011, 06:35:41 PM
 
Windows XP introduced visual styles, a way to provide a new look to the common controls, with ComCtl32.dll version 6.0. Unlike previous versions of this library, version 6.0 is not redistributable.

There are two ways to make an existing application theme aware:


Additionaly, the application must initialize the common controls library by calling the InitCommonControls or InitCommonControlsEx API functions.

The manifest XML document required to use XP visual styles is as follows:


<?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.YourApplication"
    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>


To compile the manifest as a resource in your application, the manifest must appear as a resource type RT_MANIFEST(24) with the identifier CREATEPROCESS_MANIFEST_RESOURCE_ID(1):


#define CREATEPROCESS_MANIFEST_RESOURCE_ID 1
#define RT_MANIFEST 24
CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST "MyManifest.xml"

or you can use the actual numeric values:


1 24 "MyManifest.xml"


For a complete explanation of how to make and use resource files with PowerBASIC see the topic "Resource Files" in the help file or manual of your compiler.

Beginning with PowerBASIC 10, you can use the #RESOURCE directive to include the manifest directly:


#RESOURCE MANIFEST,  1, "MyManifest.xml"


MSDN documentation: http://msdn.microsoft.com/en-us/library/bb773187%28VS.85%29.aspx

Attached to this post there is a help file with the Visual Styles documentation adapted to the PowerBASIC syntax.
Title: Using Visual Styles with a Custom Control
Post by: José Roca on August 29, 2011, 06:36:22 PM
 
Using Visual Styles with a Custom Control

To enable a control to apply visual styles:


Note  You can find the headers to use XP Visual Styles with PowerBASIC in Uxtheme.inc, part of my Windows API headers.

See also Button_SetImageList for another way of using images in buttons if you are going to use them only in Windows XP or higher.