The Wiert Corner – irregular stream of stuff

Jeroen W. Pluimers on .NET, C#, Delphi, databases, and personal interests

  • My badges

  • Twitter Updates

  • My Flickr Stream

  • Pages

  • All categories

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 1,764 other followers

Delphi XE, Windows Theming, your DPR and the Project Options in the IDE

Posted by jpluimers on 2014/11/19

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

6 Responses to “Delphi XE, Windows Theming, your DPR and the Project Options in the IDE”

  1. […] case for all Delphi versions, but I forgot which versions suffer and which don’t. I think the IDE theming issue omitting the Application word in the .dpr is […]

  2. Rick said

    I’m gonna’ start calling you Dennis the menace because you always find a way to break Delphi. :-)

  3. thaddyThaddy said

    Jeroen, the best way to solve this has always been to include the manifest in a separate resource with a meaningful name. I have some named precompiled resources available, just for that purpose.

  4. Thank you for sharing this tip :)

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

 
%d bloggers like this: