Supporting Visual Styles in Snap-ins
Visual styles are a feature of Windows Server 2003 and are supported by MMC 2.0. Your snap-in should support visual styles for improved user interface (UI) experience and consistency.
When your snap-in supports visual styles, UI elements (such as dialog boxes) that are created by your snap-in will display in the visual style selected by the user.
To support visual styles, create a manifest resource to your snap-in DLL. The manifest resource indicates that your snap-in uses Microsoft Common Control version 6 (Comctl32.dll) if it is available (otherwise, it uses an earlier version of Microsoft Common Control).
The following sections provide information about how to support visual styles in your snap-in:
- Create a manifest resource
- Include Microsoft Common Control
- Set the ISOLATION_AWARE_ENABLED directive
- Reference the manifest file
For more information and a list of additional steps necessary to support themes in MFC snap-ins, see Supporting Visual Styles in MFC Snap-ins.
To support visual styles, your snap-in must have a manifest resource that uses the Microsoft Common Controls version 6.0 assembly. The manifest resource consists of XML. The manifest file is of the following format:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0"> <assemblyIdentity version="220.127.116.11" processorArchitecture="X86" name="YourCompanyName.YourDivision.YourApp" type="win32" /> <description>Your app description here</description> <dependency> <dependentAssembly> <assemblyIdentity type="win32" name="Microsoft.Windows.Common-Controls" version="18.104.22.168" processorArchitecture="X86" publicKeyToken="6595b64144ccf1df" language="*" /> </dependentAssembly> </dependency> </assembly>
You can choose the values for your name and description attributes. If you are building for the Itanium 64-bit architecture, indicate it with the appropriate value for both occurrences of processorArchitecture. Other than the values for name, description and processorArchitecture (if necessary), do not change the text in the manifest.
Specify a name for the manifest file. This example assumes the file is named "YourApp.manifest", and the file is in the same folder as your snap-in's resource file (.rc).
Include the common control header file in your snap-in source.
Compile your snap-in with the -D ISOLATION_AWARE_ENABLED flag, or insert the following statement before the #include "windows.h" statement.
Define a manifest resource ID of 2.
In your resource script (.rc) file, use the manifest resource ID to define a resource of type RT_MANIFEST. The manifest file that you created corresponds to the RT_MANIFEST resource.
MANIFEST_RESOURCE_ID RT_MANIFEST "YourApp.manifest"
Your snap-in is ready to compile and test.