windows从Vista起引入了UAC控制,对应用程序的一些行为做出了限制,例如修改注册表的操作,如果程序没有申请到管理员权限就无法执行该操作。如何让delphi开发的程序可以支持在启动时就申请管理员权限呢,可以参考这篇博文http://tech.ddvip.com/2009-04/1239359402114436.html

   需要特别说明的是如果使用Delphi2010开发,IDE会自动为项目添加一个资源文件,在这个资源文件中就有UAC控制节,资源文件的名称与项目名称相同,文件的内容如下:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
  
<assemblyIdentity
    
type="win32"
    name
="CodeGear RAD Studio"
    version
="14.0.3615.26342" 
    processorArchitecture
="*"/>
  
<dependency>
    
<dependentAssembly>
      
<assemblyIdentity
        
type="win32"
        name
="Microsoft.Windows.Common-Controls"
        version
="6.0.0.0"
        publicKeyToken
="6595b64144ccf1df"
        language
="*"
        processorArchitecture
="*"/>
    
</dependentAssembly>
  
</dependency>
  
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
    
<security>
      
<requestedPrivileges>
        
<requestedExecutionLevel
          
level="asInvoker"
          uiAccess
="false"/>
        
</requestedPrivileges>
    
</security>
  
</trustInfo>
</assembly>

相关文章:

  • 2022-12-23
  • 2022-02-04
  • 2022-12-23
  • 2022-02-08
  • 2022-01-14
  • 2021-09-02
  • 2021-12-30
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-11-03
  • 2021-12-28
  • 2021-11-09
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案