WM_ENABLE这个消息是窗口被禁用后发出的,不是用来禁用控件。 禁用控件用下面这个函数 CWnd::EnableWindow BOOL EnableWindow( BOOL bEnable = TRUE ); Return Value Indicates the state before the EnableWindow member function was called. The return value is nonzero if the window was previously disabled. The return value is 0 if the window was previously enabled or an error occurred. Parameters bEnable Specifies whether the given window is to be enabled or disabled. If this parameter is TRUE, the window will be enabled. If this parameter is FALSE, the window will be disabled.
跟MFC的函数名一样,只不过加一个窗口句柄参数而已EnableWindow The EnableWindow 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, // handle to window BOOL bEnable // flag for enabling or disabling input );
Parameters hWnd Handle to the window to be enabled or disabled. bEnable Specifies whether to enable or disable the window. If this parameter is TRUE, the window is enabled. If the parameter is FALSE, the window is disabled.
禁用控件用下面这个函数
CWnd::EnableWindow
BOOL EnableWindow( BOOL bEnable = TRUE );
Return Value
Indicates the state before the EnableWindow member function was called. The return value is nonzero if the window was previously disabled. The return value is 0 if the window was previously enabled or an error occurred.
Parameters
bEnable
Specifies whether the given window is to be enabled or disabled. If this parameter is TRUE, the window will be enabled. If this parameter is FALSE, the window will be disabled.
pWnd->EnableWindow(FALSE);
就可以了
The EnableWindow 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, // handle to window
BOOL bEnable // flag for enabling or disabling input
);
Parameters
hWnd
Handle to the window to be enabled or disabled.
bEnable
Specifies whether to enable or disable the window. If this parameter is TRUE, the window is enabled. If the parameter is FALSE, the window is disabled.