For anyone who hits this, the following code will handle it - and allow arbitrary window manipulation in between. It logs all non-minimized window handles, and when you're done, it checks for any windows that are displayed now, were displayed before (according to its handle) and whose state has changed from non-minimized to minimized, and restores it.
Things it doesn't do - it doesn't handle clashes of window handles, and it doesn't remember the active window (their Z-order). If anyone wants to fix for those, please do!
#Include <Array.au3> dim $OriginalNonMinimizedWindows $OriginalNonMinimizedWindows="" $winlist = WinList() If $winlist > 0 Then for $i = 1 to $winlist $winhdl = $winlist[$i] $state = WinGetState($winhdl) If BitAND($state,16) <> 16 Then _ArrayAdd($OriginalNonMinimizedWindows, $winhdl) Next EndIf _ArraySort($OriginalNonMinimizedWindows) WinMinimizeAll() sleep (1500) $winlist = Winlist() If $winlist > 0 Then For $i = 1 to $winlist $winhdl = $winlist[$i] $state = WinGetState($winhdl) If BitAND($state, 16) == 16 Then If _ArrayBinarySearch($OriginalNonMinimizedWindows, $winhdl) >= 0 Then WinSetState($winhdl, "", @SW_RESTORE) msgbox(1,"","Restored window for: " & $winlist[$i] & " (handle "& $winlist[$i] & ").", 1) EndIf EndIf Next EndIf
Edited by Stilez, 31 July 2011 - 08:15 PM.