Home > Language Reference > System Functions > IsRunning

IsRunning

The IsRunning function checks if the specified process is running.

Usage

Used to check if a process is running and take conditional action depending on the result.

Syntax

var = IsRunning(<process_name>)

Parameters

<process_name>. string, name of the process to check (case insensitive). If <process_name> does not include an extension, the .EXE extension is assumed. <process_name> can include a path.

Return value

var, integer. If <process_name> is running, the return value is 1. If it is not running or if the function fails, the return value is 0.

Examples

a = IsRunning("Wordpad") ' Returns 1 if Wordpad.exe is loaded.

a = IsRunning("Comdlg32.dll") ' Returns 1 if Comdlg32.dll is loaded.

prog$ = "c:\WinTask\mfc42.dll"
a = IsRunning(prog$) ' Retunrs 1 if mfc42.dll is loaded (the one in c:\WinTask)


'Kills the application if it is running
Shell("notepad",1)
If IsRunning("notepad") then
KillApp("notepad",1)
Endif