Manifest和GetVersionEx

Tom*_*Tom 0 delphi manifest delphi-xe4 windows-10

我目前正在尝试在我的example.exe程序旁边添加一个example.manifest文件,因此GetVersionEx会返回正确的信息.

然而 - 它似乎没有任何差别 - 我仍然只有6.2

这是我打算用于所有32/64位Windows可执行文件的清单文件

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3">
  <dependency>
    <dependentAssembly>
      <assemblyIdentity
        type="win32"
        name="Microsoft.Windows.Common-Controls"
        version="6.0.0.0"
        publicKeyToken="6595b64144ccf1df"
        language="*"
        processorArchitecture="*"
      />
    </dependentAssembly>
  </dependency>
  <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
    <security>
      <requestedPrivileges>
        <requestedExecutionLevel
          level="asInvoker"
          uiAccess="false"
        />
      </requestedPrivileges>
    </security>
  </trustInfo>
  <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-8e2d-a2440225f93a}"/>
      <!-- Windows 8 -->
      <supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"/>
    </application>
  </compatibility>
</assembly>
Run Code Online (Sandbox Code Playgroud)

Dal*_*kar 9

除了@David的回答.

无需外部工具和编辑res文件.较新的Delphi版本(包括XE4)在项目选项中设置了允许包含自定义外部清单文件,Delphi将负责构建并将其包含在最终可执行文件中.

Project Options -> Application -> Runtime Themes- 选择Use custom manifest并浏览清单文件.

在此输入图像描述


Dav*_*nan 5

该文件应该被命名example.exe.manifest,而不是example.manifest

但即便如此,IIRC,supportedOS外部清单的设置也会被忽略。因此,您必须将清单作为资源嵌入。在任何情况下,这都是一种更强大的方法。