Delphi external exe with admin privileges is minimized in Windows 8

1.3k views Asked by At

I have an issue where the Windows 8 User Account Control (UAC) popup is minimized when I execute a command line helper program that requests admin privileges in its manifest. The UAC popup window just blinks yellow in the Windows taskbar, causing a confusing user experience:

Minimized UAC

After clicking the taskbar icon, then the UAC alert shows:

UAC Alert

In Windows 7, the UAC alert is not minimized but shows in the foreground. Any thoughts on how to fix this in Windows 8?

For reference, my main application runs under user privilege and executes the helper program with ShellExecuteEx. I am setting ShellExecuteEx's TShellExecuteInfo.nShow to SW_SHOW.

1

There are 1 answers

0
Sertac Akyuz On BEST ANSWER

MSDN says ".. you must pass a parent HWND with a ShellExecute .." and explains,

The UAC elevation mechanism uses the HWND as part of determining whether the elevation is a background or foreground elevation. If the application is determined to be a background application, the elevation is placed on the taskbar as a blinking button. ..

Be sure to supply your foreground window's handle to ShellExecuteEx.