解决方案 »

  1.   

    http://bbs.csdn.net/topics/380061587
      

  2.   

    管理员身份运行,必须潜入一个res文件:1) 首先编辑一个文本文件,命名为*.manifest (例如uac.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)才能正常运行。2)然后新建一个文本文件,命名为*.rc(例如为uac.rc),内容如下所示:1 24 UAC.manifest其中:
    1-代表资源编号
    24-资源类型为RTMAINIFEST
    UAC.manifest-前面的文件名称3)将rc文件加入到项目中
        将rc文件增加到项目中;(在项目文件上点击右键,然后选择add,加入rc文件)
    4)build项目,生成文件在win7下,就会看程序图标下面显示UAC盾牌标志了;
        此时运行程序,就会出现询问对话框了。
      

  3.   


    谢谢。我是 delphi 菜鸟,两个最基本的 delphi 程序都不会写。
    您能告诉我,写一个 Delphi 程序代码,实现:
    运行 D: \ MyLib.exe一个完整的 Delphi 程序 (代码)非常感谢!
      

  4.   

     A=' D: \ MyLib.exe';
    B:='cmd.exe /c Start '+A;
      WinExec(PChar(B),1);