Command Reference

Close Program

Locates and closes a running program.

Action ID: 6
Action Category: Open/Close Programs

Settings

Look For

Select the method to use in order to determine whether or not the program is running:

Full path and file name

The Name field specifies the full path and filename of the program to find (e.g. "C:\Program Files\Setup Factory 6.0\SUF60Design.exe").

File name only

The Name field specifies only the filename of the program to find (e.g. "SUF60Design.exe").

Window title

The Name field identifies the title of the Window that should be closed (e.g. "Untitled - Setup Factory 6.0").

Name

The full path and filename, filename only, or window title of the program to look for. (The meaning depends on which Look for option is selected.)

If Program is Running

Select the action to be taken if Setup Factory determines that the program is running:

Send it a close message

Send the program a WM_CLOSE message. This allows the program to end in the usual fashion. This is exactly like selecting Close in the title bar menu of the program's window, or using the Alt-F4 hotkey to close the program.

Force immediate termination

Immediately terminate the program's process. The state of global data maintained by the program's dynamic-link libraries (DLLs) may be compromised if this option is used. (When this option is selected, the setup executable calls the Windows API function "TerminateProcess" to immediately terminate the specified program.)

Tell the user to close the program

Display a "Retry/Cancel" message box that tells the user to manually shut down the program. The user must close the specified program manually and then click the Retry button to continue with the installation.

When this option is selected, the Program Description field is enabled so a user-friendly description of the program can be provided.

Program description

Allows you to provide a user-friendly name for the program that needs to be closed. Use a name or description that will be more helpful to the user than the program's filename or window title.

Program must be closed for setup to continue

Determines whether the program must be closed in order for the setup to continue.

If selected, this action will fail if the program is not closed successfully.

If unselected, the action will not fail. Even if the program isn't closed, the setup will proceed normally.

Return Values

Value
(%LastErrorNum%)

Simple Message
(%LastErrorMsg%)

Verbose Message
(%LastErrorDetails%)

0 (OK)

 

 

1

Failed to close program.

<<Name>>

Examples

Example 1

In this example we will close Notepad if it is running on the user's system.

Look for: File name only
Name: Notepad.exe
If Program is Running: Send close message
Program must be closed to continue: TRUE

Example 2

In this example we will see if Notepad is running on the user's system, and we will ask that the user close Notepad before they continue with the installation.

In this case, if the user chooses to leave Notepad running, we'll let the installation continue.

Look for: File name only
Name: Notepad.exe
If Program is Running: Tell the user to close the program
Program description: Notepad
Program must be closed to continue: Unchecked

 

See Also: Alphabetical List of Actions, Categorical List of Actions, On Error tab