CodeBlocks設置程式UAC執行級別
CodeBlocks設置程式UAC執行級別
資料來源:: http://blog.csdn.net/kxcfzyk/article/details/20116293
GITHUB:https://github.com/jash-git/CB_UAC_test
只要在專案內新增resource.rc和manifest.xml檔案即可
resource.rc
#include <windows.h> 1 RT_MANIFEST ".\\manifest.xml"
manifest.xml
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0"> <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3"> <security> <requestedPrivileges> <requestedExecutionLevel level="requireAdministrator"/> </requestedPrivileges> </security> </trustInfo> </assembly> © 2021 GitHub, Inc.
CB_UAC_test.cbp
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?> <CodeBlocks_project_file> <FileVersion major="1" minor="6" /> <Project> <Option title="CB_UAC_test" /> <Option pch_mode="2" /> <Option compiler="gcc" /> <Build> <Target title="Debug"> <Option output="bin/Debug/CB_UAC_test" prefix_auto="1" extension_auto="1" /> <Option object_output="obj/Debug/" /> <Option type="1" /> <Option compiler="gcc" /> <Compiler> <Add option="-g" /> </Compiler> </Target> <Target title="Release"> <Option output="bin/Release/CB_UAC_test" prefix_auto="1" extension_auto="1" /> <Option object_output="obj/Release/" /> <Option type="1" /> <Option compiler="gcc" /> <Compiler> <Add option="-O2" /> </Compiler> <Linker> <Add option="-s" /> </Linker> </Target> </Build> <Compiler> <Add option="-Wall" /> <Add option="-fexceptions" /> </Compiler> <Unit filename="main.cpp" /> <Unit filename="manifest.xml" /> <Unit filename="resource.rc"> <Option compilerVar="WINDRES" /> </Unit> <Extensions> <code_completion /> <envvars /> <debugger /> <lib_finder disable_auto="1" /> </Extensions> </Project> </CodeBlocks_project_file> © 2021 GitHub, Inc.