如何在XP中对应用程序使用当前主题的控件?

    即使在xp操作系统下,vc6 or vc.net下生成的对话框资源中依旧是原始风格的控件,有一个简单的方法可以实现使用当前主题风格的控件:
1)将以下代码另存成扩展名为.manifest的文件,比如为:app.manifest
<?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="Microsoft.Windows.atest"
    type="win32"
/>
<description>description</description>
<dependency>
    <dependentAssembly>
        <assemblyIdentity
            type="win32"
            name="Microsoft.Windows.Common-Controls"
            version="6.0.0.0"
            processorArchitecture="X86"
            publicKeyToken="6595b64144ccf1df"
            language="*"
        />
    </dependentAssembly>
</dependency>
</assembly>
2)外加式应用:将上述文件修改成与应用程序相同的文件名:比如应用程序的文件名是:vcfly.exe,则该文件应该名为:vcfly.exe.manifest,并放在相同的路径下即可。
内嵌式应用:将app.manifest放到res目录下,将在工程的rc文件加入如下代码:
1 24 "app.manifest"
即可.
posted on 2006-03-25 00:05  vcfly  阅读(815)  评论(0)    收藏  举报