【问题标题】:How do I prevent programmatically the "Program Compatibility Assistant" in Vista (and Windows 7) from appearing?如何以编程方式防止 Vista(和 Windows 7)中的“程序兼容性助手”出现?
【发布时间】:2010-12-07 23:03:34
【问题描述】:

我开发了一个可能使用 adobe flash 的 C++ 程序,虽然它不是必需的。
我使用 CoCreateInstance 创建 flash 对象,如果失败,我知道 flash 没有安装,所以我不使用它。
但是,在 Vista 中(我也认为是 Windows 7),当未安装 flash 时,离开应用程序后,“程序兼容性助手”会弹出一条消息,指出“此程序需要缺少 Windows 组件”,指定 flash。 ocx.

有没有办法阻止此消息出现?我不想强迫任何用户安装 flash(特别是因为它是 IE ActiveX,而 FireFox 用户可能没有安装它),并且我的应用程序可以在没有 flash 的情况下正常运行。
另外,每次运行后都会出现此消息,这真的很烦人。
我当然不是说禁用用户机器上的 PCA,而是以编程方式禁用所有机器上的这种特定外观。

有什么想法吗?
谢谢

[编辑:]

我跟随 Shay 的领导(谢谢),并自己进行了一些挖掘。我将以下 XML 添加到应用程序的清单中:

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

(另见:msdn.microsoft.com/en-us/library/bb756929.aspx
这解决了 Vista 64 上的问题。

为了解决 Windows 7 上的相同问题,我添加了以下内容:

<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
  <application>
    <!--The ID below indicates application support for Windows Vista -->
    <supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"/>
    <!--The ID below indicates application support for Windows 7 -->
    <supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/>
  </application>
</compatibility>

(另见:blogs.msdn.com/yvesdolc/archive/2009/09/22/the-new-compatibility-section-in-the-application-manifest.aspx

已解决 Windows 7。

但出于某种原因,它仍然会在 Vista 32 中发生...

我还尝试编辑导致问题的特定 DLL 的清单,但没有效果。只有可执行文件的清单本身会影响问题。

所以... Vista 32?

【问题讨论】:

    标签: flash winapi com windows-vista compatibility


    【解决方案1】:

    来自here 的片段(谈论设置但与您的情况相关)

    如何为我的用户选择退出程序兼容性助手? 设置?

    为了防止程序 兼容性助手 出现,您必须包括一个 指定一个嵌入式清单 为您请求的执行级别 设置可执行文件。如果你把 在自解压文件中设置可执行文件 包,您还必须包括一个 嵌入清单中 自解压包也是。一旦您 这样做,Windows Vista 将处理您的 设置为支持 Windows Vista,并且它 将不再显示 PCA 对话框 当安装程序在失败后退出时或 取消。

    【讨论】:

    • 感谢您的快速回复。我跟随你的领导,但问题没有完全解决。请参阅上面编辑过的问题。
    猜你喜欢
    • 1970-01-01
    • 2011-03-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2010-10-10
    • 1970-01-01
    • 2010-10-07
    • 1970-01-01
    相关资源
    最近更新 更多