How do I prevent programmatically the "Program Compatibility Assistant" in Vista (and Windows 7) fro
- by Asaf
I develop a C++ program which might use adobe flash, although it is not essential.
I use CoCreateInstance to create the flash object, and if it fails, I know flash is not installed so I don't use it.
However, in Vista (and I think Windows 7 as well), when flash is not installed, after leaving the application, the "Program Compatibility Assistant" pops up a message saying that "This program requires a missing Windows component" specifying the flash.ocx.
Is there a way to prevent this message from appearing? I don't want to force any user to install flash (especially since it's the IE ActiveX, and FireFox users might not have it installed), and my application can operate well without the flash.
Plus this message is really annoying when it appears after every run.
I don't mean of course disabling the PCA on the user's machine, but programmatically disable this specific appearance on all machines.
Any thoughts?
Thanks
[EDIT:]
I followed Shay's lead (thanks), and did some more digging of my own. I added the following XML to the application's manifest:
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
<security>
<requestedPrivileges>
<requestedExecutionLevel level="asInvoker" uiAccess="false">
</requestedExecutionLevel>
</requestedPrivileges>
</security>
</trustInfo>
(see also: msdn.microsoft.com/en-us/library/bb756929.aspx)
This solved the problem on Vista 64.
To solve the same problem on Windows 7, I added the following:
<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>
(See also: blogs.msdn.com/yvesdolc/archive/2009/09/22/the-new-compatibility-section-in-the-application-manifest.aspx)
Solved Windows 7.
But for some reason, it still happens in Vista 32...
I also tried editing the manifest of the specific DLL which causes the problem, but it had no effect. Only the executable's manifest itself affected the problem.
So... Vista 32?