# Function Reference

# WinKill

Forces a window to close.

WinKill ( "title" [, "text"] )

## Parameters

title | The title/hWnd/class of the window to close. See Title special definition.
text | [optional] The text of the window to close. Default is an empty string. See Text special definition.

## Return Value

Success: | 1.
Failure: | The function only returns the success value.

## Remarks

The difference between this function and WinClose() is that WinKill() will forcibly terminate the window if it doesn't close quickly enough. Consequently, a user might not have time to respond to dialogs prompting the user to save data. Although WinKill() can work on both minimized and hidden windows, some windows (notably explorer windows) can only be terminated using WinClose().

## Related

ProcessClose, WinActivate, WinClose, WinSetState

## Example

    Example()

    Func Example()
        ; Run Notepad
        Run("notepad.exe")

        Local $hWnd = WinWaitActive("[CLASS:Notepad]", "", 10)

        ; Wait for 2 seconds before calling the WinKill function.
        Sleep(2000)

        ; Kill the window using the handle returned by WinWaitActive.
        WinKill($hWnd, "")
    EndFunc   ;==>Example