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

  • 相关阅读:
    文件操作-图片的拷贝
    UIBarbuttonItem
    pod 'Masonry' 自动布局
    文件操作——图片保存到本地
    IOS简单的定位
    UITapGestureRecognizer+动画
    KVO
    UIScrollView
    UITextField的使用
    1228.1——计算器(未使用MVC设计模式)
  • 原文地址:https://www.cnblogs.com/mumble/p/3382305.html
Copyright © 2011-2022 走看看