You can create a manifest file to state that the application requires elevation to administrator. It's a normal text document that you can create in Notepad and it's loaded by Windows when the application is executed.
Here's an example of a manifest, for an application called MyApplication
.
<?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="MyApplication"
type="win32"/>
<description>Description of your application</description>
<!-- Identify the application security requirements. -->
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
<security>
<requestedPrivileges>
<requestedExecutionLevel
level="requireAdministrator"
uiAccess="false"/>
</requestedPrivileges>
</security>
</trustInfo>
</assembly>
Then simply name it MyApplication.exe.manifest
(replacing MyApplication
with whatever your executable name is) and it'll get loaded by UAC automatically.
You can also embed the manifest in the resource section of your executable, if you name it appropriately.
See this for more details: http://msdn.microsoft.com/en-us/library/bb756929.aspx