我使用CoCreateInstance创建flash对象,如果失败,我知道flash没有安装,所以我不使用它。
然而,在Vista(我也认为Windows 7)中,当没有安装flash时,离开应用程序后,“程序兼容性助手”会弹出一条消息,说“这个程序需要一个丢失的Windows组件”,指定flash.ocx。
是否有方法防止此消息出现?我不想强迫任何用户安装flash(特别是因为它是IE ActiveX,而FireFox用户可能没有安装它),我的应用程序在没有flash的情况下可以正常运行。
当然,我的意思不是在用户的机器上禁用PCA,而是在所有机器上编程禁用这个特定的外观。
谢谢
[编辑:]
我在谢伊的带领下(谢谢),又做了一些自己的挖掘。我将以下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上的问题。
为了在Windows7上解决同样的问题,我添加了以下内容:
<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
)
但不知为什么,
在Vista 32中仍然会发生
我还尝试编辑导致问题的特定DLL的清单,但没有效果。只有可执行文件的清单本身会影响问题。
所以。。。维斯塔32?