C++: Run program as administrator

后端 未结 2 1816
终归单人心
终归单人心 2020-12-31 06:02

Some programs are automatically asking for administrator rights when you run them. These programs are marked with a little shield in the bottom right corner:
Now I\'m

2条回答
  •  别那么骄傲
    2020-12-31 06:14

    You must be probably looking for CreateProcessAsUser or CreateProcessWithLogonW function.

    There is one more option like this:-

    • Go to the project's Property Pages dialog box.
    • Now open the Configuration Properties node.
    • Next you have to open the Linker node.
    • then select the Manifest File property.
    • Finally modify the Enable User Account Control (UAC), UAC Execution Level, and UAC Bypass UI Protection properties.

    Soemthing like this:

    enter image description here

    And as Syam correctly mentioned in the comments the solution could be to embed a manifest in the executable.

提交回复
热议问题