Copyright © 2008-2018, dave - Code samples on Dave's Brain is licensed under the Creative Commons Attribution 2.5 License. However other material, including English text has all rights reserved.
Date: 2010apr27 OS: Windows Q. How can I embed a manifest in my program? A. Starting with Vista manifests have two purposes (that I know of):- Turning on the Aero (glass) look of the controls - Turning on elevated security for your program when UAC is enabledThe manifest usually lives in a file called <YourProgram>.exe.manifest in the same folder as your .cpp files. For Aero make it contain this:<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0"> <assemblyIdentity version="18.104.22.168" processorArchitecture="X86" name="<YourProgamHumanName>" type="win32" /> <!-- the <description> tag is required but you don't have to fill it out --> <description></description> <!-- for Aero add this ... Usually you DO want this --> <dependency> <dependentAssembly> <assemblyIdentity type="win32" name="Microsoft.Windows.Common-Controls" version="22.214.171.124" processorArchitecture="X86" publicKeyToken="6595b64144ccf1df" language="*" /> </dependentAssembly> </dependency> <!-- for elevated permissions add this... Usually you do NOT want this --> <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3"> <security> <requestedPrivileges> <requestedExecutionLevel level="requireAdministrator" uiAccess="false"/> </requestedPrivileges> </security> </trustInfo> </assembly>Here's how you embed it in your program. In Microsoft Visual C++ 2005 and later add it as add would a .cpp file (under "Source Files") and it will be correctly embedded when you build. In Borland C++ 5.02 open your .rc (resource) file in a text editor and paste in:#define RT_MANIFEST 24 #define APP_MANIFEST 1 APP_MANIFEST RT_MANIFEST <YourProgram>.exe.manifestand build. It would be nice to be able to embed a manifest in a DLL. Eg make your DLL use Aero when invoked by a older EXE (that doesn't have a manifest). You can embed a manifest in a DLL but my experiments have shown that its ignored. Maybe because the common controls are already initialized by the time the DLL is called?
Add a commentSign in to add a comment