Enabling XP themes (Only Exe Project Type)


Easy Code allows you to automatically include an XP theme manifest in a project. XP themes enable the Windows Common controls 6.0 in order to take advantage of the new look for controls in Windows XP and later. A manifest is just a text file in XML format, and for Easy Code to be able to include it in the executable, the manifest file must be named Manifest.xml and it has to be in the project's Res folder (when creating a new project, Easy Code also creates a default Manifest.xml file in the project's Res folder). Besides, you must check the Manifest option in the Project Properties. That way, it will be included in the executable file as a resource and the new controls will be enabled. Below is a simple example of an XP theme manifest for 32-bit applications:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity>
    version="2.0.00.0001"
    processorArchitecture="x86"
    name="EasyCode.exe"
    type="win32"
</assemblyIdentity>
<description>Assembly visual programming environment</description>
<dependency>
    <dependentAssembly>
        <assemblyIdentity>
            type="win32"
            name="Microsoft.Windows.Common-Controls"
            version="6.0.0.0"
            publicKeyToken="6595b64144ccf1df"
            processorArchitecture="x86"
            language="*"
        />
    </dependentAssembly>
</dependency>
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
    <application>
        <!-- Windows 10 -->
        <supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"/>
        <!-- Windows 8.1 -->
        <supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"/>
        <!-- Windows Vista -->
        <supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"/>
        <!-- Windows 7 -->
        <supportedOS Id="{35138b9a-5d96-4fbd-08e2d-a2440225f93a}"/>
        <!-- Windows 8 -->
        <supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"/>
    </application>>
</compatibility>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
    <security>
        <requestedPrivileges>
            <requestedExecutionLevel
                level="asInvoker"
                uiAccess="false"
            />
        </requestedPrivileges>
    </security>
</trustInfo>
</assembly>

For 64-bit applications, the manifest should look like this (note the changes in the processorArchitecture entry):

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity>
    version="2.0.00.0001"
    processorArchitecture="amd64"
    name="EasyCode.exe"
    type="win32"
</assemblyIdentity>
<description>Assembly visual programming environment</description>
<dependency>
    <dependentAssembly>
        <assemblyIdentity>
            type="win32"
            name="Microsoft.Windows.Common-Controls"
            version="6.0.0.0"
            publicKeyToken="6595b64144ccf1df"
            processorArchitecture="amd64"
            language="*"
        />
    </dependentAssembly>
</dependency>
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
    <application>
        <!-- Windows 10 -->
        <supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"/>
        <!-- Windows 8.1 -->
        <supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"/>
        <!-- Windows Vista -->
        <supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"/>
        <!-- Windows 7 -->
        <supportedOS Id="{35138b9a-5d96-4fbd-08e2d-a2440225f93a}"/>
        <!-- Windows 8 -->
        <supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"/>
    </application>>
</compatibility>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
    <security>
        <requestedPrivileges>
            <requestedExecutionLevel
                level="asInvoker"
                uiAccess="false"
            />
        </requestedPrivileges>
    </security>
</trustInfo>
</assembly>

You just have to replace the version, name and description fields (those shown in blue bold font). Rebuild all the examples coming with Easy Code and see the look of the new common controls in Windows XP and later systems.

IMPORTANT: The GetVersionEx API function will return the Windows 8 OS version (ecWin8) for applications not specifically manifested for Windows 8.1 or Windows 10, even if they are running on Windows 8.1 or Windows 10. To manifest your applications for Windows 8.1 or Windows 10, the Manifest file has to include some additional lines (for more information, please click this link). The default Manifest.xml file generated by Easy Code when creating a new project, already includes the necessary lines for the application to be manifested properly.

REMARKS: At design time, or when testing a window, all control objects will be shown with the new common controls style if the Manifest option is selected in the Project Properties. Otherwise, they will be shown with the old controls style.

REMARKS: Take into account that the Manifest.xml file has no effect for Windows systems prior to XP.