0

レジストリにアクセスする必要があるため、.manifest ファイルを使用してアプリケーションに管理者権限を追加しました。それは今私の.exeにあります。それを行う前に、アプリケーションで素敵なランタイム テーマが有効になっていました。そのテーマは私を悩ませているものです。古いバージョンの Windows のようです。完全に時代遅れ。私が使用した.manifestファイルが原因であることはわかっていますが、.manifestファイル内で何を追加/変更/削除してWindowsテーマを有効にし、管理者権限を保持するかわかりません。私は何をすべきか?

これは私の .manifest ファイルの中にあります:

<?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="*"
     name="My app"
     type="win32"/> 
    <compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1"> 
            <application> 
                <!--This Id value indicates the application supports Windows Vista functionality -->
                <supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"/> 
                <!--This Id value indicates the application supports Windows 7 functionality-->
                <supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/>
                <!--This Id value indicates the application supports Windows 8 functionality-->
                <supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"/>
                <!--This Id value indicates the application supports Windows 8.1 functionality-->
                <supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"/>
            </application> 
    </compatibility>
    <!-- Identify the application security requirements. -->
    <trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
        <security>
            <requestedPrivileges>
                <requestedExecutionLevel
                level="requireAdministrator"
                uiAccess="false"/>
            </requestedPrivileges>
       </security>
  </trustInfo>
</assembly>
4

1 に答える 1

1

アプリはマニフェストを 1 つしか持てないため、カスタム マニフェストを使用する場合は、アプリのマニフェストに必要なすべての関連セクションを指定する必要があります。そのため、ComCtrl32 v6 を有効にするセクションを追加する必要があります。

<?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="*"
    name="My app"
    type="win32"/> 
  <!-- enable Comctrl v6 for visual styles -->
  <dependency>
    <dependentAssembly>
      <assemblyIdentity
        type="win32"
        name="Microsoft.Windows.Common-Controls"
        version="6.0.0.0"
        processorArchitecture="*"
        publicKeyToken="6595b64144ccf1df"
        language="*"/>
    </dependentAssembly>
  </dependency>
  <compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1"> 
    <application> 
      <!--This Id value indicates the application supports Windows Vista functionality -->
      <supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"/> 
      <!--This Id value indicates the application supports Windows 7 functionality-->
      <supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/>
      <!--This Id value indicates the application supports Windows 8 functionality-->
      <supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"/>
      <!--This Id value indicates the application supports Windows 8.1 functionality-->
      <supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"/>
    </application> 
  </compatibility>
  <!-- Identify the application security requirements. -->
  <trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
    <security>
      <requestedPrivileges>
        <requestedExecutionLevel
          level="requireAdministrator"
          uiAccess="false"/>
      </requestedPrivileges>
    </security>
  </trustInfo>
</assembly>
于 2014-06-06T23:02:11.173 に答える