It is impossible to do for the already executing process. You can only start one more process (even if this is the same application). Another approach is to add appropriate
application manifest which would force the runtime system to request the user for UAC
elevation confirmation from the very beginning.
For the first approach, please see:
CreateProcessAsUser function (Windows)[
^].
For the second (manifest) approach, please see, for example, this answer:
C++ — How to run application with Admin privileges using Manifest file in Visual Studio 2005?[
^].
Note that it is impossible to elevate the privileges without explicit user's consent. If it was possible, it would defeat the purpose of UAC. Please see:
User Account Control — Wikipedia, the free encyclopedia[
^].
—SA