Archive: UAC plugin, installer window goes behind


UAC plugin, installer window goes behind
using the nullsoft UAC plugin v0.2.2d.zip, i find that the installer window often launches behind other windows (like the browser that opened it).

any ideas how to force it front most?


You could try 2.3, I can't remember if it is fixed there or not.


I tried 2.3 but I think it didn't work on Vista (I should reverify this).

Nonetheless, was this a known bug and fixed at some point?


This is a known issue (somewhat), but like Anders said, he doesn't remember whether he already fixed it or not.


if a fix was made to bring the installer window frontmost, can you kindly tell me where in the code? i will compare the two builds to confirm which version has the fix. thanks.


There is no simple fix you can just apply


Originally posted by Anders
There is no simple fix you can just apply
No? What about System::Call 'user32::SetForegroundWindow(i r0)' in .onGuiInit?

EDIT: $0 (r0) should contain the Installer HWND

SetForegroundWindow only works if your process has set foreground rights (During .onInit we have no window and so we lose the foreground "lock")


*facepalm* yes you are right. :-) (or not? i wrote .onGUIinit not .onInit)
An if you put this in the "show_function" of the first window?
Or create a (immediately leaved) custom page before the first internal page and put this in the leave_function?

cheers


Feel free to give it a try and find out. :-)

I don't have this problem because I don't elevate in .onInit, but that opened up a whole other bag of trouble. Like, getting the outer instance to hide properly.


I donĀ“t have to... user pbeisel have to try it. :-)
I have no problem.


hi all,

first, just wanted to thank everyone for nsis. i have worked with a bunch of installers over the years and my experience with nsis has been, by far, the best. thanks for the hard work and great product!

at the moment, i am struggling with the uac plugin. i think my issue is similar to the one being discussed here. when running my installer, when i get to the elevate permissions step, the dialog doesn't show up on the screen -- instead, i just see a shield icon in the tray at the bottom of the screen. when i click the shield, then is see the dialog. after that, everything works correctly. but i am concerned the my customers won't see shield and will get stuck.

i am hoping there is just a problem with my installer script. does anyone know what might be causing this?

i noticed that the dropbox installer (http://www.dropbox.com) appears to use nsis and the uac plugin and their elevate permissions dialog shows up right away as it should.

anyone have any ideas?

thanks


Where are you trying to elevate? .onInit? .onGuiInit? Somewhere else?


we are elevating in onInit()



Function .onInit

UAC_Elevate:
!insertmacro UAC_RunElevated
StrCmp 1223 $0 UAC_ElevationAborted ; UAC dialog aborted by user?
StrCmp 0 $0 0 UAC_Err ; Error?
StrCmp 1 $1 0 UAC_Success ;Are we the real deal or just the wrapper?
Quit

UAC_Err:
MessageBox mb_iconstop "Unable to elevate, error $0"
Abort

UAC_ElevationAborted:
# elevation was aborted, run as normal?
MessageBox mb_iconstop "The installer requires admin access."
Abort

UAC_Success:

System::Call 'kernel32::CreateMutexA(i 0, i 0, t "myMutex") i .r1 ?e'
Pop $R0

StrCmp $R0 0 +3
MessageBox MB_OK|MB_ICONEXCLAMATION "The installer is already running."
Abort

StrCmp 1 $3 +4 ;Admin?
StrCmp 3 $1 0 UAC_ElevationAborted ;Try again?
MessageBox mb_iconstop "The installer requires admin access. Please try again."
goto UAC_Elevate

FunctionEnd

What is the RequestExecutionLevel setting in your script?


I don't think that should matter, as far as I know UAC_elevate will runas admin $EXEPATH regardless of the current level.

I guess if noone else has a solution, you could always try elevating after the window has been created... >_>


Asking about RequestExecutionLevel is pointless, if you set it to admin, the plugin becomes pointless and has no effect


Originally posted by pbeisel
using the nullsoft UAC plugin v0.2.2d.zip, i find that the installer window often launches behind other windows (like the browser that opened it).

any ideas how to force it front most?
Doing the elevation in .onGuiInit rather than .onInit solved that issue for me ;)