Qt权限设置

QT版本:5.5.1 QT Creator


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


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

[html]  view plain  copy
  在CODE上查看代码片 派生到我的代码片
  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
  在CODE上查看代码片 派生到我的代码片
  1. 1 24 manifest.xml  

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

[html]  view plain  copy
  在CODE上查看代码片 派生到我的代码片
  1. RC_FILE+= adminis.rc  

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

[html]  view plain  copy
  在CODE上查看代码片 派生到我的代码片

  1. RC_FILE+= adminis.rc  

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

[html]  view plain  copy
  在CODE上查看代码片 派生到我的代码片
  1. 1 24 manifest.xml 
  2. IDI_ICON1 ICON DISCARDABLE "res/LauncherIco.ico"  

权限种类:



  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
1. 创建一个新的manifest.json文件,保存在你的项目根目录下。 2. 在文件中声明manifest文件的版本号,格式如下: ``` { "manifest_version": 2 } ``` 注意:manifest_version属性必须设置为2。 3. 添加应用程序的名称和描述信息,格式如下: ``` { "manifest_version": 2, "name": "My App", "description": "This is my first Chrome extension." } ``` 4. 添加应用程序的图标,格式如下: ``` { "manifest_version": 2, "name": "My App", "description": "This is my first Chrome extension.", "icons": { "16": "icon16.png", "48": "icon48.png", "128": "icon128.png" } } ``` 注意:icons属性中的值是一个对象,其中键表示图标的大小,值表示图标的文件路径。 5. 添加应用程序的权限,格式如下: ``` { "manifest_version": 2, "name": "My App", "description": "This is my first Chrome extension.", "icons": { "16": "icon16.png", "48": "icon48.png", "128": "icon128.png" }, "permissions": [ "tabs", "storage", "http://*/", "https://*/" ] } ``` 注意:permissions属性中的值是一个数组,表示应用程序需要的权限。 6. 添加应用程序的入口点,格式如下: ``` { "manifest_version": 2, "name": "My App", "description": "This is my first Chrome extension.", "icons": { "16": "icon16.png", "48": "icon48.png", "128": "icon128.png" }, "permissions": [ "tabs", "storage", "http://*/", "https://*/" ], "browser_action": { "default_icon": "icon.png", "default_popup": "popup.html" } } ``` 注意:browser_action属性表示应用程序的入口点,其中default_icon属性表示应用程序的图标,default_popup属性表示应用程序的弹出窗口。 7. 最后,将manifest.json文件添加到你的扩展程序中。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值