Oldschool 0 Posted October 24, 2007 (edited) I wrote this, but it tries to kill everything...including the "program manager" I just want to close windows that are visible... Any ideas? WinSetState($MainApp, "", @SW_MINIMIZE) $win = WinList() For $wl = 0 To $win[0][0] If WinExists($win[$wl][0]) And IsVisible($win[$wl][0]) = 1 Then WinClose($win[$wl][0]) EndIf Next Func IsVisible($handle) If BitAnd( WinGetState($handle), 2 ) Then Return 1 Else Return 0 EndIf EndFunc Edited October 24, 2007 by Oldschool Share this post Link to post Share on other sites
DjDeep00 0 Posted October 24, 2007 Try this out...$var = WinList() For $i = 1 to $var[0][0] ; Only display visble windows that have a title If $var[$i][0] <> "" AND IsVisible($var[$i][1]) Then ;MsgBox(0, "Details", "Title=" & $var[$i][0] & @LF & "Handle=" & $var[$i][1]) If $var[$i][0]<>"Program Manager" then WinClose($var[$i][0]) EndIf Next Func IsVisible($handle) If BitAnd( WinGetState($handle), 2 ) Then Return 1 Else Return 0 EndIf EndFunc Share this post Link to post Share on other sites
weaponx 16 Posted October 24, 2007 What is considered visible? Does that include minimized? Share this post Link to post Share on other sites
Blue_Drache 260 Posted October 24, 2007 No, minimized sets its own bit. Lofting the cyberwinds on teknoleather wings, I am...The Blue Drache Share this post Link to post Share on other sites