Closes a window.
WinClose ( "title" [, "text"] )
This function sends a close message to a window, the result depends on the window (it may ask to save data, etc.). To force a window to close, use the WinKill() function. If multiple windows match the criteria, the window that was most recently active is closed.
ProcessClose, WinActivate, WinExists, WinKill, WinMove, WinSetState, WinTitleMatchMode (Option)
#include <MsgBoxConstants.au3>
Example()
Func Example()
; Run Notepad
Run ("notepad.exe")
; Wait for 2 seconds to display the Notepad window.
Sleep (2000)
; Close the Notepad window using the classname of Notepad.
If WinClose ("[CLASS:Notepad]","")Then
MsgBox ($MB_SYSTEMMODAL,"","Window closed")
Else
MsgBox ($MB_SYSTEMMODAL+ $MB_ICONERROR,"Error","Window not Found")
EndIf
EndFunc ;==>Example