Search code examples
c++xmlmanifestc++builder-xe3

Configure application manifest C++ Builder XE3


I've added administrator rights to my application using .manifest file because i need access to the registry. Its in my .exe now. Before i did that my application had nice runtime theme enabled. That theme is whats bothering me. It looks like old versions of Windows. Completely outdated. I know it's because that .manifest file i used, but i don't know what to add/change/delete inside the .manifest file to enable Windows theme and to keep administrative privileges. What should i do?

This is inside my .manifest file:

<?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>

Solution

  • An app can only have 1 manifest, so when you use a custom manifest then you are responsible for specifying ALL relevant sections that your app needs to be manifested. As such, you need to add the section that enables 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>