I found an interesting article here.
In order to make the application support elevation, we need to define a manifest for the application. It's just a simple XML file with the following in it:
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1"
manifestVersion="1.0">
<assemblyIdentity version="1.0.0.0" processorArchitecture="X86"
name="UacDemo" type="win32"/>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
<security>
<requestedPrivileges>
<requestedExecutionLevel level="requireAdministrator"/>
</requestedPrivileges>
</security>
</trustInfo>
</assembly>
Add a file called UacDemo.exe.manifest to the project and copy/paste the XML chunk in there. The last thing to do is to embed the manifest in the executable as a Win32Resource. An embedded resource is VS2005 can't be used for this. It's a little more complex than this. With the SDK, a tool called mt.exe ships that can be used to manage manifests in executables (for gurus, perform a dumpbin on the .exe file before and after the execution of mt.exe to see the application manifest being copied to the file). We'll be invoking this tool as a post-build step by going to the project properties, tab Build Events and pasting the following in Post-build even command line:
"$(DevEnvDir)..\..\SDK\v2.0\bin\mt.exe" -manifest
"$(ProjectDir)$(TargetName).exe.manifest"
–outputresource:"$(TargetDir)$(TargetFileName)";#1