tags:

views:

84

answers:

2

My product needs to change file association. To allow it to run as non-admin in Vista, I have moved the registry changing code to a separate binary called "assocsetup.exe".

When launched, Vista UAC correctly asks for permission to run it as admin with the "A program needs your permission to continue" message.

However, it doesn't bring it to front immediately. It just flashes its entry on the taskbar and the user must click on it to bring up the UAC window.

Is there any way to automatically make the UAC window visible so the taskbar click is avoided?

Thanks!

+1  A: 

Common sense over here, but since UAC triggers the prompt on Window focus, isn't there a way to focus the assocsetup.exe Window so it can dim the desktop and prompt?

Jimmie Lin
Yeah that's what I want to know. I tried EnumWindows to find the process, but the prompt is displayed before the process is created, so I cannot enumerate windows to find the UAC window.
dribler
+1  A: 

You don't say how you start your helper program, but I assume you are using ShellExecute (You did not specify a language in the tags)

Remember to pass the HWND of your current window to ShellExecute[Ex] (This window needs to be the foreground window when this call is made for the UAC dialog to show as the active window)

Anders

related questions