Window - Close

Closes a specific window.

Action ID:
Action Category:
Action List Syntax:

130
Window
Window.Close (<<HWND>>, <<CLOSETYPE>>)

Settings

hWnd:

An integer value that represents the "handle" of the window (or program) on the user's desktop that you want to close. The hWnd value can be determined using a "Window - Find" action, or the built-in variable %MenuHWnd% (which is the hWnd value for the AutoPlay application's window) can be used.

If Program is Running

Select the action to be taken once AutoPlay determines that the program (that the window belongs to) 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 clicking on the "X" shaped button on the window's title bar, 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 AutoPlay application calls the Windows API function "TerminateProcess" to immediately terminate the specified program.)

Tell the user to close the program

Display a message box that tells the user to manually shut down the program.

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 exact text in the program's window title.

This field is only available when the Tell the user to close the program option is selected above.

Error Codes

Value
(%LastErrorNum%)

Simple Message
(%LastErrorMsg%)

Verbose Message
(%LastErrorDetails%)

0 (OK)

 

 

1

MSG_ERR_WINDOW_CLOSE

MSG_ERR_WINDOW_CLOSE
MSG_ERR_WINDOW_NO_MATCHING_PARAMS
hWnd: <<HWND>>

Examples

None