Tom
Tom

Reputation: 3637

Manifest and GetVersionEx

I am currently experimenting with adding an example.manifest file next to my example.exe program, so GetVersionEx() returns correct information.

However - it seems to not have made any difference at all - I still only get 6.2.

Here is my manifest file that I intend to use for all my 32/64 bit Windows executables:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3">
  <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>
  <compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
    <application>
      <!-- Windows 10 -->
      <supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"/>
      <!-- Windows 8.1 -->
      <supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"/>
      <!-- Windows Vista -->
      <supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"/>
      <!-- Windows 7 -->
      <supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/>
      <!-- Windows 8 -->
      <supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"/>
    </application>
  </compatibility>
</assembly>

Upvotes: 1

Views: 758

Answers (3)

Tom
Tom

Reputation: 3637

The way I ended up solving this was using a resource tool (e.g. Resource Tuner can do it) to add the manifest file to the .res file.

  • I have turned off all IDE stuff for themes, custom manifest, icons etc.
  • I do not include xpman in uses
  • I include my .res file containing manifest and icons inside main .dpr unit

It works since both themes and getversionex now returns correct results.

...

For build automation - my build script generated by another script pulls in the correct .res file depending on product/edition being built.

Upvotes: 0

Dalija Prasnikar
Dalija Prasnikar

Reputation: 28530

In addition to @David's answer.

There is no need for external tools and editing res files. Newer Delphi versions (XE4 included) have setting in Project Options that allows including custom external manifest file and Delphi will take care of building and including it into final executable.

Project Options -> Application -> Runtime Themes - select Use custom manifest and browse for your manifest file.

enter image description here

Upvotes: 10

David Heffernan
David Heffernan

Reputation: 613432

The file should be named example.exe.manifest rather than example.manifest.

But even then, IIRC, the supportedOS settings are ignored for an external manifest. So you will have to embed the manifest as a resource instead. This is a much more robust approach in any case.

Upvotes: 5

Related Questions