Quantcast
Channel: Planet Object Pascal
Viewing all articles
Browse latest Browse all 1725

The Wiert Corner - irregular stream of stuff: jpluimers

$
0
0

A while ago I bumped into a funny problem with Delphi XE.

I moved all the code from the .dpr in a Main unit (the IDE sometimes overwrites part of the DPR).

This normally isn’t a problem, until Delphi re-generates the .RES file. The reason is that this .RES file can contain a manifest which enables Windows theming.

If there is no reference of the Application object in the .DPR, the IDE will remove the Theming manifest from the .RES file, so your application run unthemed.

Three solutions:

  • include a reference to the Application in the .dpr,
  • or add the XPMan unit to the uses list  (no need to put the TXPManifest on a form or datamodule),
  • or upgrade to Delphi XE2 or newer.

You don’t see the effect until the IDE does regenerate the RES file. Which it will do when you change the version information. Which you had to do for the new build.
Took some effort to find the actual steps that overwrote the RES. It’s kind of undocumented.

Note: this happens at least in Delphi XE, and probably in Delphi 2005-2009 as well.

It was fixed in Delphi XE2, where you can even choose your own .manifest file which is great, because besides theming, you can also control UAC through the manifest.

Note: if you want an UAC manifest, you

  1. have to create your own manifest containing the requestedPrivileges and requestedExecutionLevel nodes.
  2. merge it with any theming manifest
  3. make sure you don’t have another theming manifest included (remove all XPMan references from your code, don’t use the Themed manifest in the project options).

From Delphi XE2 and up, just reference the manifest file from the project options. For XE and below, create an RC file referencing the manifest, compile the RC into a RES and include the RES in your application.

–jeroen


Filed under: Delphi, Delphi XE, Delphi XE2, Delphi XE3, Delphi XE4, Delphi XE5, Development, Software Development

Viewing all articles
Browse latest Browse all 1725

Trending Articles