• QT5.5.1 为Qtcreator 编译的程序添加管理员权限


    QT版本:5.5.1 QT Creator

    QT Creator 编译出来的程默认是不带管理员权限的。有时是需要管理员权限。

    第一步: 创建文件 uac.manifest 添加如下代码

    [html] view plain copy
     
    1. <?xml version="1.0" encoding="UTF-8" standalone="yes"?>    
    2. <assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">    
    3. <assemblyIdentity    
    4.     version="1.0.0.0"    
    5.     processorArchitecture="X86"    
    6.     name="mulitray.exe.manifest"    
    7.     type="win32"    
    8. />    
    9. <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">    
    10.     <security>    
    11.         <requestedPrivileges>    
    12.             <requestedExecutionLevel level="requireAdministrator" uiAccess="false"/>    
    13.         </requestedPrivileges>    
    14.     </security>    
    15. </trustInfo>    
    16. </assembly>    


    第二步: 创建资源文件 adminis.rc

    [html] view plain copy
     
    1. 1 24 UAC.manifest  


    第三步: 在xxx.pro文件中添加

    [html] view plain copy
     
    1. RC_FILE+= adminis.rc  


    注意事项: 我在开发中在xxx.pro同时添加

    [html] view plain copy
     
    1. #RC_FILE+= app.rc  
    2. RC_FILE+= adminis.rc  


    这是编译出来的程序,是没有管理员权限的。可以把多个资源写到同一个 .rc文件中。

    [html] view plain copy
     
      1. 1 24 UAC.manifest  
      2. IDI_ICON1 ICON DISCARDABLE "res/LauncherIco.ico"  

    http://blog.csdn.net/chinahaerbin/article/details/52382478

  • 相关阅读:
    (转)大数据量高并发的数据库优化与sql优化
    SQL Server查询优化方法参考(转)
    CString和LPCSTR区别(转)
    delphi读写剪贴板的一些参考
    Delphi和VC混合编程总结
    Delphi 一些函数解释
    伪共享与volatile
    happens-before原则
    递归与回溯-排立组合
    二叉树
  • 原文地址:https://www.cnblogs.com/findumars/p/8244901.html
Copyright © 2020-2023  润新知