zoukankan      html  css  js  c++  java
  • Qt 程序默认管理员权限运行

    解决方案一

    在pro文件中添加
    QMAKE_LFLAGS += /MANIFESTUAC:"level='requireAdministrator'uiAccess='false'"

    解决方案二

    假设需要管理员权限的程序为MyApp.exe

    把MyApp.exe,MyApp.exe.manifest,mt.exe放到同一个目录,打开命令提示符,cd到该目录,执行下面命令

    mt.exe -manifest "MyApp.exe.manifest" -outputresource:"MyApp.exe";#1

    MyApp.exe.manifest参考内容如下

     1 <?xml version='1.0' encoding='UTF-8' standalone='yes'?>
     2 <assembly xmlns='urn:schemas-microsoft-com:asm.v1' manifestVersion='1.0'>
     3   <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
     4     <security>
     5       <requestedPrivileges>
     6         <requestedExecutionLevel level='requireAdministrator' uiAccess='false' />
     7       </requestedPrivileges>
     8     </security>
     9   </trustInfo>
    10 </assembly>

    mt.exe在C:Program FilesWindows Kits下,装过visual studio的。

    为了方便,做成批处理,下载:QT管理员权限补丁

  • 相关阅读:
    数据库基础+重置root密码
    Bug定级
    测试用例和测试方法
    测试基础
    HDOJ-1010 Tempter of the Bone(dfs)
    POJ
    HDU-2089 不要62 (数位DP)
    Happy!
    LOJ-1422 万圣节服装
    数字三角形(数塔问题)
  • 原文地址:https://www.cnblogs.com/ybqjymy/p/13612722.html
Copyright © 2011-2022 走看看