IsRunning

System function.

The IsRunning function indicates whether a program is loaded in memory or not.

Usage

Depending if a process is running or not, you take the appropriate action, for example, you kill it.

Syntax

a=IsRunning(<module_name>)

Parameters

<module_name>, string which defines the name of the program ; if an extension is not included, .EXE is assumed. It can be a constant or a variable; the path must be included in <module_name> if the exe cannot be started by just typing its name in the Start/Run or Search dialog box.

Return value

a = 1 if the program is loaded, 0 otherwise.

Examples

 

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

 

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

 

prog$ = "c:\taskware\mfc42.dll"

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

'Kills the application if it is running

Shell("notepad",1)

If IsRunning("notepad") then

KillApp("notepad",1)

Endif