Wednesday, November 16, 2011

Manifests in VB6

As usual after much beating of head against the wall this turns out be pretty straightforward.

Why would you need a manifest?

A manifest file will enable you to control how your program interacts with Windows User Access Control (UAC). It won't stop UAC being invoked but you can make sure your program gets the level of access you require rather than just hanging or having to get the user to set the program to "Run as Administrator".

There are plenty of examples of manifest files on the internet.

If your program is called "Fred.exe" the manifest file is named "fred.exe.manifest" and the name is set to "fred.exe" in the manifest.


You can either just place the manifest in the installation folder which seems easiest or embed it in the program.

The key things to know are -

Windows will only look for the manifest file once. If you add a manifest file to an existing installation folder it will be ignored unless you alter the time stamp of the exe file so including it in your set up package is best.

The Version number in the manifest file appears to be ignored so you can just use 1.0.0.0 without worrying about keeping it in line with the actual exe version.

If you require Administrator access to be requested when the program runs set the requiredexecutionlevel to "requireAdministrator" uiaccess="false"