user32: Don't hide the window in SetParent when window and parent are equal.

This commit is contained in:
Bernhard Übelacker 2010-02-02 14:16:02 +01:00 committed by Alexandre Julliard
parent b184b13c5f
commit 8d127f3a81
2 changed files with 12 additions and 0 deletions

View File

@ -445,6 +445,12 @@ static void test_parent_owner(void)
ret = SetParent( test, child );
ok( ret == desktop, "SetParent return value %p expected %p\n", ret, desktop );
check_parents( test, child, child, 0, 0, hwndMain, test );
ShowWindow( test, SW_SHOW );
ret = SetParent( test, test );
ok( ret == NULL, "SetParent return value %p expected %p\n", ret, NULL );
ok( GetWindowLongA( test, GWL_STYLE ) & WS_VISIBLE, "window is not visible after SetParent\n" );
check_parents( test, child, child, 0, 0, hwndMain, test );
DestroyWindow( test );
/* owned popup */

View File

@ -2701,6 +2701,12 @@ HWND WINAPI SetParent( HWND hwnd, HWND parent )
if (!(full_handle = WIN_IsCurrentThread( hwnd )))
return (HWND)SendMessageW( hwnd, WM_WINE_SETPARENT, (WPARAM)parent, 0 );
if (full_handle == parent)
{
SetLastError( ERROR_INVALID_PARAMETER );
return 0;
}
/* Windows hides the window first, then shows it again
* including the WM_SHOWWINDOW messages and all */
was_visible = ShowWindow( hwnd, SW_HIDE );