加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

flash – 如何以编程方式阻止Vista(和Windows 7)中的“程序兼容

发布时间:2020-12-15 19:47:10 所属栏目:百科 来源:网络整理
导读:我开发了一个可能使用adobe flash的C程序,虽然它不是必需的. 我使用CoCreateInstance创建flash对象,如果失败,我知道没有安装flash,所以我不使用它. 但是,在Vista(我也认为是Windows 7)中,当没有安装flash时,在离开应用程序后,“程序兼容性助手”弹出一条消息
我开发了一个可能使用adobe flash的C程序,虽然它不是必需的.
我使用CoCreateInstance创建flash对象,如果失败,我知道没有安装flash,所以我不使用它.
但是,在Vista(我也认为是Windows 7)中,当没有安装flash时,在离开应用程序后,“程序兼容性助手”弹出一条消息,指出“此程序需要缺少Windows组件”指定闪存. OCX.
有没有办法阻止此消息出现?我不想强迫任何用户安装闪存(特别是因为它是IE ActiveX,而FireFox用户可能没有安装它),并且我的应用程序可以在没有闪存的情况下正常运行.
再加上这条消息在每次运行后出现时都非常烦人.
我当然不是要在用户的计算机上禁用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?

解决方法

来自 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.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读