Home > Language Reference > System Functions > KillAppChildren

KillAppChildren

The KillAppChildren function kills the specified application and its child processes.

Usage

Used to force an application (a program file or EXE) to close. It closes too the child processes started by the parent application.

Syntax

ret = KillAppChildren(<application_name>, 0|1 [, <userid>])

Parameters

<application_name>. string, name of the application to kill (a .EXE, case insensitive). The extension can be omitted. All the instances of the application and its child processes are killed. If the application A calls B, which calls C - if for any reason, B is killed, a KillAppChildren of A won't be able to kill the child C.

0|1. If 1, the application is killed immediately. If 0, a confirmation dialog box is displayed; after 60 seconds, the application is killed.

<userid>, string. If specified, KillAppChildren kills only the instances of the specified application which have been started by <userid>.

Return value

ret, optional integer return value. If the application has been killed successfully, the return value is 0. If the application has been killed successfully after the user confirmation, the return value is 1. If the function fails, the return value is a negative value (see System Functions Error Codes).

See also

KillApp
KillProcess

Example

'The script below launches Notepad, types some text and exits. A dialog box is displayed asking if the document has to be saved.
'As KillAppChildren is used with the 1 flag, the application Notepad is killed immediately.
Shell("notepad",1)
UseWindow("NOTEPAD.EXE|Edit||1",1)
SendKeys("Hello")
'Exit notepad
UseWindow("NOTEPAD.EXE|Notepad|",1)
SendKeys("<Alt <F4>>")
'Kill notepad and its children immediately
KillAppChildren("notepad",1)