In Visual Studio, add a new file to your project, select "application manifest" as the file type and then click okay.
You will get an XML document. The first big chunk of the document goes something like this:
<requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
<!-- UAC Manifest Options
If you want to change the Windows User Account Control level replace the
requestedExecutionLevel node with one of the following.
<requestedExecutionLevel level="asInvoker" uiAccess="false" />
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
<requestedExecutionLevel level="highestAvailable" uiAccess="false" />
Specifying requestedExecutionLevel node will disable file and registry virtualization.
If you want to utilize File and Registry Virtualization for backward
compatibility then delete the requestedExecutionLevel node.
-->
<requestedExecutionLevel level="asInvoker" uiAccess="false" />
De-comment the line that says:
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
This will make that application (or a DLL) run the UAC to get administrator privileges.
If you only want a particular component to run elevated, then put that code in a separate DLL file. When your main program first calls that assembly, the UAC will appear, and elevation will be granted.