VC编译出来的应用程序在vista下运行,有可能因为权限问题,不能成功运行。

用以下办法,给应用程序添加一个manifest文件,程序运行时系统就会跳出UAC对话框,获得管理权限。

1.打开应用程序的源代码工程

2.添加一个“custom”资源,"resource type"填24,把资源ID改为1,然后把以下内容复制到资源内容中保存

 <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity
    version="1.0.0.0"
    processorArchitecture="X86"
    name="mulitray.exe.manifest"
    type="win32"
/>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
    <security>
        <requestedPrivileges>
            <requestedExecutionLevel level="requireAdministrator" uiAccess="false"/>
        </requestedPrivileges>
    </security>
</trustInfo>
</assembly> 

3.重新编译应用程序,此时会发现,应用程序的图标在vista下会多出一个小盾标志。

相关文章:

  • 2021-12-18
  • 2022-12-23
  • 2021-10-09
  • 2021-12-05
  • 2021-06-11
  • 2021-08-13
  • 2021-06-25
猜你喜欢
  • 2022-01-13
  • 2022-12-23
  • 2021-12-31
  • 2021-04-04
  • 2021-06-09
  • 2021-11-20
  • 2021-11-25
相关资源
相似解决方案