如何使用 NSIS 在后台打开第二个 Internet Explorer 窗口



这是一个简单的问题,但找不到简单的答案......
我正在NSIS中编写脚本,我需要在Internet Explorer中打开两个窗口

所以我用...
UAC::Exec '' '"$PROGRAMFILES\Internet Explorer\iexplore.exe" "$url_1" '' ''
然后。。。
UAC::Exec '' '"$PROGRAMFILES\Internet Explorer\iexplore.exe" "$url_2" '' ''

但是我希望在带有 $url_1 的后面/背景中打开 $url_2
我快疯了...感谢您的任何帮助!

附言。我不会被迫使用 UAC::Exec,只要它启动一个新的 IE 窗口。

答案很简单:只需切换打开窗口的顺序:

UAC::Exec '' '"$PROGRAMFILESInternet Exploreriexplore.exe" "$url_2' '' ''
then...
UAC::Exec '' '"$PROGRAMFILESInternet Exploreriexplore.exe" "$url_1' '' '' 

所以 $url_2 将落后于 $url_1,因为它稍后打开......

编辑

如果您希望在前面有一些确切的窗口,则必须知道它的名称(IE在完全加载后将名称设置为窗口)。

使用这个简单的循环将所需的窗口放在前面。(我使用了Exec,但与UAC和nsExec配合良好)

; This Window is opened as first
Exec '"$PROGRAMFILESInternet Exploreriexplore.exe" "www.google.sk"' # $url_1
; This is opened later
Exec '"$PROGRAMFILESInternet Exploreriexplore.exe" "www.unsigned-softworks.sk/installer"'  # $url_2
CheckWindow:
  Sleep 500 ; Wait some time (miliseconds)
  ; Find by Window class and by Window name 
  FindWindow $1 "IEFrame" "Google - Windows Internet Explorer" 
  # This name must be known in compile time!!!
  # Get this name by running $url_1 in IE
  ; If window is not found (not loaded!) search again 
  IntCmp $1 0 CheckWindow Continue Continue
Continue:
  # If found (opened & loaded), bring $url_1 to front
  System::Call "User32::SetForegroundWindow(i) b ($1)"

最好的选择是用 c++ 编写自己的插件,并使用 CreateProcess() 和 SetForgroundWindow() 的组合。

最新更新