Delphi 7 vista/windows 7清单

col*_*lin 15 delphi uac manifest delphi-7

有没有人有一个Delphi 7清单文件的例子,允许应用程序在Windows XP/Vista/7上以管理员身份运行?

使用此功能运行应用程序通常会导致用户帐户控制(UAC)对话框询问特权权限.

Isa*_*aac 21

以下是步骤:

1.删​​除XPMan:删除XPMan项目中对组件的任何引用.XPMan向可执行文件添加默认清单,以防止Windows查看我们的自定义清单.您不应该担心提供的XP主题XPMan,主题支持保留在以下清单中.

2.创建自定义清单:Win7UAC.manifest在项目目录中创建一个文件(文件名确实无关紧要).将以下行添加到Win7UAC.manifest:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
  <assemblyIdentity type="win32" name="App" version="3.1.0.0" 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="requireAdministrator" uiAccess="false"/>
        </requestedPrivileges>
    </security>
  </trustInfo>
  <compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
    <application>
      <!--The ID below indicates application support for Windows Vista -->
      <supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"/>
      <!--The ID below indicates application support for Windows 7 -->
      <supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/>
    </application>
  </compatibility>
</assembly>
Run Code Online (Sandbox Code Playgroud)

您可以向此清单添加更多项目.您还可以删除Microsoft.Windows.Common-Controls部件以禁用主题支持.

3.将清单编译为资源:Win7UAC.rc在项目目录中创建一个包含一行的文件:

1 24 "Win7UAC.manifest"
Run Code Online (Sandbox Code Playgroud)

要编译此文件,请转到cmd,指向项目目录并运行以下命令:

brcc32.exe Win7UAC.rc
Run Code Online (Sandbox Code Playgroud)

4.将资源(清单)添加到项目中:只需在项目的某个单元文件中的任何位置添加以下行:

{$R 'Win7UAC.res'}
Run Code Online (Sandbox Code Playgroud)

添加此行的合适位置在项目主文件(通常命名Project1.dpr)和{$R *.res}行下.

5.重建项目

6.记住每当您将XPMan组件添加到任何项目单元时,此UAC清单将无法正常运行.

  • 我会为你们节省搜索时间...... <! - 下面的ID表示Windows 8的应用程序支持 - > <supportedOS Id ="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"/> {4a2f28e3-适用于Windows 8的53b9-4441-ba9c-d69d4a4a6e38}:在应用程序清单中设置此值的应用程序获取Windows 8行为 (2认同)

Sig*_*dur 6

以下是一些信息链接

Vista UI主要节目

Delphi和Windows Vista用户帐户控制

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>

<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
  <dependency>
    <dependentAssembly>
      <assemblyIdentity
        type="win32"
        name="Microsoft.Windows.Common-Controls"
        version="6.0.0.0"
        publicKeyToken="6595b64144ccf1df"
        language="*"
        processorArchitecture="x86" />
    </dependentAssembly>
  </dependency>

  <trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
    <security>
      <requestedPrivileges>
        <requestedExecutionLevel
          level="highestAvailable"/>
      </requestedPrivileges>
    </security>
  </trustInfo>
</assembly>
Run Code Online (Sandbox Code Playgroud)


Cos*_*und 2

这对我来说效果很好:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>

<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
  <dependency>
    <dependentAssembly>
      <assemblyIdentity
          type="win32"
          name="Microsoft.Windows.Common-Controls"
          version="6.0.0.0"
          publicKeyToken="6595b64144ccf1df"
          language="*"
          processorArchitecture="x86"
        />
    </dependentAssembly>
  </dependency>

  <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
    <security>
      <requestedPrivileges>
        <requestedExecutionLevel level="highestAvailable" />
      </requestedPrivileges>
    </security>
Run Code Online (Sandbox Code Playgroud)

</assembly>
Run Code Online (Sandbox Code Playgroud)