CWnd::EnableWindow

Syntax

BOOL EnableWindow( BOOL bEnable = TRUE );

Parameters

bEnable

Specifies whether the given window is to be enabled or disabled. If this parameter is TRUE, the CWnd will be enabled. If this parameter is FALSE, the CWnd will be disabled.

Remarks

Enables or disables mouse and keyboard input. When input is disabled, input such as mouse clicks and keystrokes is ignored. When input is enabled, the window processes all input.

If the enabled state is changing, the WM_ENABLE message is sent before this function returns.

If disabled, all child windows are implicitly disabled, although they are not sent WM_ENABLE messages.

CWnd must be enabled before it can be activated. For example, if an application is displaying a modeless dialog box and has disabled its main window, the main window must be enabled before the dialog box is destroyed. Otherwise, another window will get the input focus and be activated. If a child window is disabled, it is ignored when Windows tries to determine which window should get mouse messages.

Initially, all windows are enabled by default. EnableWindow must be used to disable CWnd explicitly.

Return Value

Indicates the state before the EnableWindow member function was called. The return value is TRUE if CWnd was previously enabled. The return value is FALSE if CWnd was previously disabled or an error occurred.

See Also

::EnableWindow