How can I embed a manifest in my program?
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 enabled
The 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="126.96.36.199" processorArchitecture="X86" name="<YourProgamHumanName>" type="win32" />
<!-- the <description> tag is required but you don't have to fill it out -->
<!-- for Aero add this ... Usually you DO want this -->
<assemblyIdentity type="win32" name="Microsoft.Windows.Common-Controls" version="188.8.131.52" processorArchitecture="X86" publicKeyToken="6595b64144ccf1df" language="*" />
<!-- for elevated permissions add this... Usually you do NOT want this -->
<requestedExecutionLevel level="requireAdministrator" uiAccess="false"/>
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.manifest
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?
In VC++ 2005 and later you add this to a .cpp file for flat controls
#pragma comment(linker,"\"/manifestdependency:type='win32' \
name='Microsoft.Windows.Common-Controls' version='184.108.40.206' \
processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"")