EndTask function (winuser.h)

[This function is not intended for general use. It may be altered or unavailable in subsequent versions of Windows.]

Forcibly closes the specified window.

Syntax

BOOL EndTask(
  [in] HWND hWnd,
  [in] BOOL fShutDown,
  [in] BOOL fForce
);

Parameters

[in] hWnd

Type: HWND

A handle to the window to be closed.

[in] fShutDown

Type: BOOL

Ignored. Must be FALSE.

[in] fForce

Type: BOOL

A TRUE for this parameter will force the destruction of the window if an initial attempt fails to gently close the window using WM_CLOSE. With a FALSE for this parameter, only the close with WM_CLOSE is attempted.

Return value

Type: BOOL

If the function succeeds, the return value is nonzero.

If the function fails, the return value is FALSE. To get extended error information, call GetLastError.

Remarks

This function was not included in the SDK headers and libraries until Windows XP with Service Pack 1 (SP1) and Windows Server 2003. If you do not have a header file and import library for this function, you can call the function using LoadLibrary and GetProcAddress.

Requirements

Requirement Value
Minimum supported client Windows 2000 Professional [desktop apps only]
Minimum supported server Windows 2000 Server [desktop apps only]
Target Platform Windows
Header winuser.h (include Windows.h)
Library User32.lib
DLL User32.dll

See also

CloseWindow

Conceptual

DestroyWindow

Reference

WM_CLOSE

Windows