I have this nsis script,
…
nsExec::Exec "openFirstWindow.exe" ;HERE This exe will open a FIRST WINDOW to whatever url
Pop $exe_return_code
StrCmp $exe_return_code "0" exe_success
Goto exe_done
exe_success:
;HERE is the call to the SECOND WINDOW
UAC::Exec '' '"$PROGRAMFILES\Internet Explorer\iexplore.exe" "http://www.google.ca"' '' ''
exe_done:
…
The problem is that randomly, I get the FIRST window in foreground and the SECOND behind,
and sometimes I get the SECOND window in front of the FIRST.
My guess is that it is due to the FIRST window taking random time to open and
if the SECOND window finishes opening before the FIRST one, then the FIRST one will get the focus and be on top.
Does anyone have a solution to make sure that the SECOND window has focus ?
Thank you!
Use this simple loop to bring required window in the front. (I used Exec, but works fine with UAC and nsExec)