Watch the presentation I prepared for Oslo Delphi Clubs meeting in December for learning what UAC is and why it will affect you.

I have only extracted a part of the presentation into this article. It is the content on how you fix it in Delphi.

You can also download the video, example application and slides.

You application should work out of the box in Windows Vista if you have followed the guidelines about how to write a well behaving Windows application that has been in the Windows logo program for years.

The only thing that has really changed is that things that earlier where recommendations is now enforced. If you break the rules Vista has some bold compatibility features that probably will make administrating your application a nightmare.

Requested Execution Level in Delphi

Include information about execution level in your executable to turn of the compatibility mode and signal to Vista if this application should run as a standard user or must be an administrator.

First add a resource with a manifest to your application. Make sure to remove all references to XPMan unit from project!!!

Using ShellExecute to start process running as administrator. The Application.Handle delays elevation if the application is minimized preventing the secure desktop to steel focus for the consent dialog when the user is doing something else. Use Application.Handle (or MainForm.Handle if you have applied other patches that make it the application windows)

If you do not use a handle UAC will always give direct foreground elevation.