zoukankan      html  css  js  c++  java
  • Delphi下如何使程序在Win7/Vista上用管理员权限运行(转)

    Delphi程序必须在资源里面嵌入MANIFEST信息
     一 首先编辑一个文件,内容如下:
    <?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>
    保存为UAC.manifest,这里文件是随意的。特别注意红色的“requireAdministrator”,这个表示程序需要管理员(Administrator)才能正常运行。

    二 然后编辑一个RC文件,名称为uac.rc 如下所示:
    1 24 UAC.manifest
    其中:
    1-代表资源编号
    24-资源类型为RTMAINIFEST
    UAC.manifest-前面的文件名称

    三 用brcc32编译这个rc文件为res文件,如下所示:
    brcc32 uac.rc -fouac.res

    四 在程序里面加入
    {$R uac.res}
    让Delphi编译的时候,把uac.res编译进exe文件

    五 把文件放到vista或win7下运行,就会看程序图标下面显示UAC盾牌标志了。

    from:http://blog.chinaunix.net/uid-20718335-id-364391.html

  • 相关阅读:
    Golang Gin 框架 Route备注
    golang的时区和神奇的time.Parse
    Linux下查看内存使用情况方法总结
    Golang 图片上绘制文字
    在linux中安装字体
    一键解决 go get golang.org/x 包失败
    go如何进行交叉编译
    Ubuntu中apt与apt-get命令的区别
    linux dns 工具包 -- bind-utils
    nohup 和 &的含义
  • 原文地址:https://www.cnblogs.com/mumble/p/3382305.html
Copyright © 2011-2022 走看看