Specifying whether elevation is required
is typically something that is the responsibility of the program.
This is done by
adding a requestedExecutionLevel
element to your manifest.
(Bart De Smet shows you how.
Calvin Hsia does the same for your Visual FoxPro programs.)
But if the program you're running doesn't have such a manifest—maybe
it's an old program that you don't have
any control over—you can create a shortcut to the program and
mark the shortcut as requiring elevation.
To do this, you set the SLDF_RUNAS_USER
flag in the
shortcut attributes.
Here's a skeleton program that sets the flag on the shortcut
whose path is passed on the command line.
For expository purposes, I've skimped on the error reporting,
and just to shake things up, I've used ATL smart pointers.