HotKeySet('{ESC}', '_HideShow')
Global $State = 0
$GUI = GUICreate('TEST', 400, 300)
GUISetState()
While 1
Switch GUIGetMsg()
Case -3
Exit
EndSwitch
WEnd
Func _HideShow()
If $State = 0 Then
GUISetState(@SW_MINIMIZE)
$State = 1
Else
GUISetState(@SW_RESTORE)
$State = 0
EndIf
EndFunc