- [User32] Send WM_CANCELMODE in EnableWindow.

svn path=/trunk/; revision=46054
This commit is contained in:
James Tabor
2010-03-10 10:19:49 +00:00
parent f94bebf2d0
commit 5d434b2f15
+27 -18
View File
@@ -109,30 +109,39 @@ BOOL WINAPI
EnableWindow(HWND hWnd,
BOOL bEnable)
{
// This will soon be moved to win32k.
BOOL Update;
LONG Style = GetWindowLongPtrW(hWnd, GWL_STYLE);
/* check if updating is needed */
UINT bIsDisabled = (Style & WS_DISABLED);
if ( (bIsDisabled && bEnable) || (!bIsDisabled && !bEnable) )
{
if (bEnable)
{
Style &= ~WS_DISABLED;
}
else
{
Style |= WS_DISABLED;
/* Remove keyboard focus from that window if it had focus */
if (hWnd == GetFocus())
{
SetFocus(NULL);
}
}
NtUserSetWindowLong(hWnd, GWL_STYLE, Style, FALSE);
Update = bIsDisabled;
SendMessageA(hWnd, WM_ENABLE, (LPARAM) IsWindowEnabled(hWnd), 0);
if (bEnable)
{
Style &= ~WS_DISABLED;
}
else
{
Update = !bIsDisabled;
SendMessageW( hWnd, WM_CANCELMODE, 0, 0);
/* Remove keyboard focus from that window if it had focus */
if (hWnd == GetFocus())
{
SetFocus(NULL);
}
Style |= WS_DISABLED;
}
NtUserSetWindowLong(hWnd, GWL_STYLE, Style, FALSE);
if (Update)
{
SendMessageW(hWnd, WM_ENABLE, (LPARAM)bEnable, 0);
}
// Return nonzero if it was disabled, or zero if it wasn't:
return IsWindowEnabled(hWnd);
return bIsDisabled;
}