The external version of Delphi with administrator rights is minimized in Windows 8

I have a problem where the Windows 8 User Account Control (UAC) popup is minimized when I run a command line helper program that asks for administrator privileges in my manifest. The UAC popup simply blinks yellow on the Windows taskbar, which confuses the user:

Minimized UAC

After clicking the icon on the taskbar, a UAC warning appears:

UAC Alert

On Windows 7, the UAC warning is not minimized, but is displayed in the foreground. Any thoughts on how to fix this in Windows 8?

For reference, my main application runs under user privilege and runs a helper program using ShellExecuteEx . I set ShellExecuteEx TShellExecuteInfo.nShow to SW_SHOW .

+7
exe windows delphi uac shellexecuteex
source share
1 answer

MSDN says: ".. you must pass the parent HWND using ShellExecute .." and explains

The UAC Elevation Mechanism uses HWND as part of determining whether height is a background or foreground. If the application is defined as a background application, the inscription on the taskbar is placed as a flashing button ...

Be sure to put the foreground window handle on ShellExecuteEx .

+8
source share

All Articles