#include <ButtonConstants.au3>
#include <GUIConstants.au3>
#include <WindowsConstants.au3>
$Form1 = GUICreate("SRO Windows", 200, 100, default, default)
$LButton1 = GUICtrlCreateButton("Gizle", 10, 10, 50, default)
$LButton2 = GUICtrlCreateButton("Seçimi tersine çevir!", 10, 45, default, default)
GUICtrlSetState($LButton1, $GUI_DISABLE)
GUISetState(@SW_SHOW)
AdlibRegister("LCheck", 1000)
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $LButton1
Lociz()
Case $LButton2
LGoToWork()
EndSwitch
WEnd
Func Lociz()
$LCommand1 = GUICtrlRead($LButton1)
if $LCommand1 = "Gizle" Then
$LClientList = WinList("[CLASS:CLIENT]")
For $k = 1 To $LClientList[0][0]
WinSetState($LClientList[$k][1], "", @SW_HIDE)
Next
GUICtrlSetData($LButton1, "Göster")
elseif $LCommand1 = "Göster" Then
$LClientList = WinList("[CLASS:CLIENT]")
For $k = 1 To $LClientList[0][0]
WinSetState($LClientList[$k][1], "", @SW_SHOW)
Next
GUICtrlSetData($LButton1, "Gizle")
EndIf
EndFunc
Func LCheck()
if not WinExists("[CLASS:CLIENT]", "") then
if GUICtrlGetState($LButton1) = 80 Then
GUICtrlSetState($LButton1, $GUI_DISABLE)
EndIf
else
if GUICtrlGetState($LButton1) = 144 Then
GUICtrlSetState($LButton1, $GUI_ENABLE)
EndIf
EndIf
EndFunc
Func LGoToWork()
$LCommand1 = GUICtrlRead($LButton1)
if $LCommand1 = "Gizle" then GUICtrlSetData($LButton1, "Göster")
if $LCommand1 = "Göster" then GUICtrlSetData($LButton1, "Gizle")
EndFunc