Oldschool Posted October 24, 2007 Share 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 Link to comment Share on other sites More sharing options...
DjDeep00 Posted October 24, 2007 Share 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 Link to comment Share on other sites More sharing options...
weaponx Posted October 24, 2007 Share Posted October 24, 2007 What is considered visible? Does that include minimized? Link to comment Share on other sites More sharing options...
Blue_Drache Posted October 24, 2007 Share Posted October 24, 2007 No, minimized sets its own bit. Lofting the cyberwinds on teknoleather wings, I am...The Blue Drache Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now