flash - 如何以编程方式防止 Vista(和 Windows 7)中的 "Program Compatibility Assistant"出现?

标签 flash winapi com windows-vista compatibility

我开发了一个可能使用 adobe flash 的 C++ 程序,尽管它不是必需的。
我使用 CoCreateInstance 创建 flash 对象,如果失败,我知道没有安装 flash,所以我不使用它。
但是,在 Vista(我认为 Windows 7 也是如此)中,当未安装 Flash 时,离开应用程序后,“程序兼容性助手”会弹出一条消息,指出“此程序需要缺少 Windows 组件”指定了 Flash。 ocx。
有没有办法防止出现此消息?我不想强制任何用户安装 flash(特别是因为它是 IE ActiveX,而 FireFox 用户可能没有安装它),而且我的应用程序可以在没有 flash 的情况下运行良好。
此外,当每次运行后出现此消息时,它真的很烦人。
我当然不是指在用户机器上禁用 PCA,而是在所有机器上以编程方式禁用此特定外观。

有什么想法吗?
谢谢

[编辑:]

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

<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 的 list ,但没有效果。只有可执行文件的 list 本身影响了问题。

所以... Vista 32?

最佳答案

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

How can I opt out of the Program Compatibility Assistant for my setup?

In order to prevent the Program Compatibility Assistant from appearing, you must include an embedded manifest that specifies a requested execution level for your setup executable. If you wrap the setup executable in a self-extracting package, you must also include an embedded manifest in the self-extracting package too. Once you do this, Windows Vista will treat your setup as Windows Vista-aware, and it will no longer show the PCA dialog when setup exits after a failure or cancellation.

关于flash - 如何以编程方式防止 Vista(和 Windows 7)中的 "Program Compatibility Assistant"出现?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1587962/

相关文章:

c++ - 将 'this' 指针传递给 SetWindowsHookEx 的 MouseProc

c++ - 在 winapi CALLBACK 函数上返回 FALSE 时出现意外行为(跳过循环?)

C# - 如何在运行时测试哪个 COM coclass 用于实例化接口(interface)?

flash - 如何使用 ActionScript 从 Flash SWF 启动 EXE?

java - 是否有 Java 到 Flash 的编译器?

flash - ZeroClipboard JavaScript 库抛出未捕获错误 : Error calling method on NPObject

actionscript-3 - 将 Adob​​e Air 打包为 Exe

c++ - 双缓冲winAPI

Silverlight 和 COM 互操作

c# - 不使用 regasm.exe 的 VB6 中的 .NET 对象?