delphi - C++ Builder/Delphi 2010 应用程序 list 模板

标签 delphi manifest c++builder

在谷歌搜索了太多让我头晕目眩的信息和一堆误导性和矛盾的信息之后,我成功地为应用程序 list 编译了以下最小"template",它应该定义以下内容:

  • 程序版本和名称
  • 它不需要任何特殊的管理员权限
  • 它与 Windows Vista 至 Windows 8.1 兼容
  • 它具有 DPI 意识

我的 list 文件是否足以实现上述目的?我是否犯了任何需要注意的错误?我对 xmlns 命名空间版本以及它们在该 list 的某些部分不同的原因特别感到困惑?

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

    <assemblyIdentity type="win32"
                      name="Manufacturer.Division.ApplicationName"
                      version="1.2.3.4"
                      processorArchitecture="x86"
    />

    <trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
        <security>
            <requestedPrivileges>
                <requestedExecutionLevel level="asInvoker" uiAccess="false" />
            </requestedPrivileges>
        </security>
    </trustInfo>

    <compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
        <application>
            <supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"/>  <!-- The application supports Windows Vista and Windows Server 2008  -->
            <supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/>  <!-- The application supports Windows 7 and Windows Server 2008 R2   -->
            <supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"/>  <!-- The application supports Windows 8 and Windows Server 2012      -->
            <supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"/>  <!-- The application supports Windows 8.1 and Windows Server 2012 R2 -->
        </application>
    </compatibility>

    <asmv3:application xmlns:asmv3="urn:schemas-microsoft-com:asm.v3">
        <asmv3:windowsSettings xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">
            <dpiAware>true</dpiAware>
        </asmv3:windowsSettings>
    </asmv3:application>

    </assembly>

编辑:这是我的最终 list 文件模板,它基于此处的帮助以及 future Google 员工的进一步研究。

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>

<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">

  <assemblyIdentity type="win32"
                    processorArchitecture="*"
                    version="1.2.3.4"
                    name="Manufacturer.Division.ApplicationName"
  />

  <description>My Application Description</description>

  <dependency>
    <dependentAssembly>
      <assemblyIdentity type="win32"
                        name="Microsoft.Windows.Common-Controls"
                        version="6.0.0.0"
                        processorArchitecture="*"
                        publicKeyToken="6595b64144ccf1df"
                        language="*"
      />
    </dependentAssembly>
  </dependency>

  <trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
    <security>
      <requestedPrivileges>
        <requestedExecutionLevel level="asInvoker" uiAccess="false" />
      </requestedPrivileges>
    </security>
  </trustInfo>

  <compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
    <application>
      <supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"/>  <!-- Windows Vista and Windows Server 2008  -->
      <supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/>  <!-- Windows 7 and Windows Server 2008 R2   -->
      <supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"/>  <!-- Windows 8 and Windows Server 2012      -->
      <supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"/>  <!-- Windows 8.1 and Windows Server 2012 R2 -->
    </application>
  </compatibility>

  <application xmlns="urn:schemas-microsoft-com:asm.v3">
    <windowsSettings>
      <dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">True/PM</dpiAware>
    </windowsSettings>
  </application>

</assembly>

编辑 2019:对于 DPI 感知 V2,需要进行如下所述的更改:

How can I set the dpiAware property in a Windows application manifest to "per monitor" in Visual Studio?

所以这部分发生变化:

  <application xmlns="urn:schemas-microsoft-com:asm.v3">
    <windowsSettings>
        <dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true/pm</dpiAware> <!-- fallback for Windows 7 and 8 -->
        <dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">permonitorv2,permonitor</dpiAwareness> <!-- falls back to per-monitor if per-monitor v2 is not supported -->
        <gdiScaling xmlns="http://schemas.microsoft.com/SMI/2017/WindowsSettings">true</gdiScaling> <!-- enables GDI DPI scaling (if needed, otherwise leave out) -->
    </windowsSettings>
  </application>

最佳答案

如果您想启用 Visual Styles,则您的 list 未启用 ComCtrl v6 :

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
  <!-- your assemblyIdentity element ... -->
  <dependency>
    <dependentAssembly>
      <assemblyIdentity
        type="win32"
        name="Microsoft.Windows.Common-Controls"
        version="6.0.0.0"
        processorArchitecture="*"
        publicKeyToken="6595b64144ccf1df"
        language="*"
      />
    </dependentAssembly>
  </dependency>
  <!-- your trustInfo, compatibility, application elements ... -->
</assembly>

您不需要在顶级 assemble 元素上声明 xmlns:asmv3 ,因为它是在 application 上重新声明的> 元素。

所使用的 XML 命名空间不同,因为它们是由不同的 API 定义的。 list 文件不是单个 API,它是在集中位置控制的多个 API 的值的集合。

关于delphi - C++ Builder/Delphi 2010 应用程序 list 模板,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25536779/

相关文章:

c++builder - 如何将Borland C++ Builder的代码移植到Linux?

c++ - 如何在 THeaderSection 中嵌入 VCL TEdit 控件?

delphi - 使用delphi使用一种软件在多个用户之间发送数据

delphi - 从鼠标光标下的像素获取 alpha channel 值

android - appComponentFactory 的 list 合并失败

visual-c++ - 为 VS2008 编译的二进制文件需要 DebugCRT 并行汇编,在 VS2010 中不起作用

delphi - 在 Delphi 中使用 XSLT 2.0 需要什么

delphi - Delphi有 "getopt"的实现吗?

ios - 有类似 iOS 版 Google Gear 的东西吗?

c++ - 如何混合 std::stream 和 Delphi TStream?