Windows XP 的外观风格[2]

[入库:2005年8月18日] [更新:2007年3月24日]

本文简介:选择自 sonicdater 的 blog

  • 将名为 yourapp.exe.manifest 的文件添加到具有以下 xml 格式的源代码树中:

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

        type="win32"

    />

    <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>

  • 将声明添加到应用程序的资源文件中,如下所示:

    createprocess_manifest_resource_id rt_manifest "yourapp.exe.manifest"

  • 注意:如果将前一项添加到资源中,则必须在一行中对其进行格式设置。或者,您可以将 xml 声明文件放置在与应用程序的可执行文件相同的目录中。操作系统将首先从文件系统加载声明,然后检查可执行文件的资源部分。文件系统版本优先。

    在使用扩展、插件或进程内运行的 dll 的应用程序中使用 comctl32 版本 6

    下面是一些使用扩展的应用程序的示例。

    • microsoft management console (mmc.exe)

    • windows shell

    • microsoft® visual studio®

    要创建声明并使您的应用程序能够使用外观风格,请执行以下步骤:

    1. 使用 windows xp beta 2 sdk 或更高版本。

    2. 包括常用控件标题文件,如下所示:

      #include "commctrl.h"

    3. 定义编译器变量预处理程序定义,如下所示:

      #define sidebyside_commoncontrols 1

      将名为 yourapp.manifest 文件添加到具有以下 xml 格式的源代码树中:

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

          type="win32"

      />

      <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>

    4. 将声明添加到应用程序的资源文件中,如下所示:

      createprocess_manifest_resource_id rt_manifest "yourapp.manifest"

      winuser.rh 包括以下定义:

      #define createprocess_manifest_resource_id 1

      #define control_panel_resource_id 123

      #define rt_manifest 24

    在控制面板中或在通过 rundll32.exe 运行的 dll 中使用 comctl32 版本 6

    要创建声明并使您的应用程序能够使用外观风格,请执行以下步骤:

    1. 链接到 comctl32.lib 并调用 initcommoncontrols

    本文关键:Windows XP 外观
     

    本站最佳浏览方式为 分辨率 1024x768 IE 6.0(或更高版本的 IE浏览器)

    go top