Important: |
---|
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist. |
This function enables or disables mouse and keyboard input to the specified window or control. When input is disabled, the window does not receive input such as mouse clicks and key presses. When input is enabled, the window receives all input.
BOOL EnableWindow( HWND hWnd , BOOL bEnable );
Parameters
Return Values
Nonzero indicates that the window was previously disabled. Zero indicates that the window was not previously disabled. To get extended error information, call GetLastError.
Remarks
If the enabled state of a window is changing, a WM_ENABLEmessage is sent before the EnableWindowfunction returns. If a window is already disabled, all its child windows are implicitly disabled, although they are not sent a WM_ENABLE message.
A window 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 application must enable the main window before destroying the dialog box. Otherwise, another window will receive the keyboard focus and be activated. If a child window is disabled, it is ignored when the system tries to determine which window should receive mouse messages.
By default, a window is enabled when it is created. To create a window that is initially disabled, an application can specify the WS_DISABLED style in the CreateWindowor CreateWindowExfunction. After a window has been created, an application can use EnableWindowto enable or disable the window.
An application can use this function to enable or disable a control in a dialog box. A disabled control cannot receive the keyboard focus, nor can a user gain access to it.
Requirements
Runs on | Versions | Defined in | Include | Link to |
---|---|---|---|---|
Windows CE OS | 1.0 and later | Winuser.h | Wmgr_c.lib |
Note This API is part of the complete Windows CE OS package as provided by Microsoft. The functionality of a particular platform is determined by the original equipment manufacturer (OEM) and some devices may not support this API.
See Also
CreateWindow, CreateWindowEx, GetLastError, IsWindowEnabled, WM_ENABLE