Commit 8d127f3a authored by Bernhard Übelacker's avatar Bernhard Übelacker Committed by Alexandre Julliard

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

parent b184b13c
......@@ -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 */
......
......@@ -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 );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment