CloseWindow

Windows management function.

The CloseWindow function closes the specified window.

Usage

Generally used to close an application or a dialog box. KillApp function is better to use if a Save dialog box is displayed when ending the application, and you do not want to save.

Syntax

CloseWindow(<window_name>[[,<instance>],forced|Immediate])
or
ret=CloseWindow(<window_name>[[,<instance>],forced|Immediate])

Parameters

<window_name>, window name of the window to close. The window name can be truncated in order to close any window starting by the characters specified in <window_name> (see the truncation algorithm at window name help topic).

<instance>,optional parameter, instance number of the window to close.

forced or Immediate, optional keyword. If forced is used, if the window cannot be closed due to a still opened dialog box, the close is forced after 30 seconds. If Immediate is used, the close is made immediately.

Return value

Ret, numeric return code. When successful, the function returns 0, otherwise use this return code for Error Handling.

See also

CloseWindowRegEx

Examples

 

CloseWindow("NOTEPAD.EXE|Notepad|Untitled")

CloseWindow("NOTEPAD.EXE|Notepad|Untitled",1)

CloseWindow("NOTEPAD.EXE|Notepad|Untitled",1,forced)