user32: Check WS_CHILD style in IsChild function.
This commit is contained in:
parent
c60e81b7c9
commit
367577c0d6
|
@ -3675,6 +3675,19 @@ static void test_SetParent(void)
|
|||
ok(SetParent(sibling, parent) != 0, "SetParent should not fail\n");
|
||||
ok(GetMenu(sibling) == hMenu, "SetParent should not remove menu\n");
|
||||
|
||||
ok(SetParent(parent, desktop) != 0, "SetParent should not fail\n");
|
||||
ok(SetParent(child4, child3) != 0, "SetParent should not fail\n");
|
||||
ok(SetParent(child3, child2) != 0, "SetParent should not fail\n");
|
||||
ok(SetParent(child2, child1) != 0, "SetParent should not fail\n");
|
||||
ok(!IsChild(child3, child4), "wrong parent/child %p/%p\n", child3, child4);
|
||||
SetWindowLongW(child4, GWL_STYLE, WS_CHILD);
|
||||
ok(IsChild(child3, child4), "wrong parent/child %p/%p\n", child3, child4);
|
||||
ok(IsChild(child2, child4), "wrong parent/child %p/%p\n", child2, child4);
|
||||
ok(!IsChild(child1, child4), "wrong parent/child %p/%p\n", child1, child4);
|
||||
SetWindowLongW(child2, GWL_STYLE, WS_CHILD);
|
||||
ok(IsChild(child1, child4), "wrong parent/child %p/%p\n", child1, child4);
|
||||
ok(IsChild(parent, child4), "wrong parent/child %p/%p\n", parent, child4);
|
||||
|
||||
ok(DestroyWindow(parent), "DestroyWindow() failed\n");
|
||||
|
||||
ok(!IsWindow(parent), "parent still exists\n");
|
||||
|
|
|
@ -3043,14 +3043,22 @@ HWND WINAPI SetParent( HWND hwnd, HWND parent )
|
|||
*/
|
||||
BOOL WINAPI IsChild( HWND parent, HWND child )
|
||||
{
|
||||
HWND *list = list_window_parents( child );
|
||||
HWND *list;
|
||||
int i;
|
||||
BOOL ret;
|
||||
BOOL ret = FALSE;
|
||||
|
||||
if (!list) return FALSE;
|
||||
if (!(GetWindowLongW( child, GWL_STYLE ) & WS_CHILD)) return FALSE;
|
||||
if (!(list = list_window_parents( child ))) return FALSE;
|
||||
parent = WIN_GetFullHandle( parent );
|
||||
for (i = 0; list[i]; i++) if (list[i] == parent) break;
|
||||
ret = list[i] && list[i+1];
|
||||
for (i = 0; list[i]; i++)
|
||||
{
|
||||
if (list[i] == parent)
|
||||
{
|
||||
ret = list[i] && list[i+1];
|
||||
break;
|
||||
}
|
||||
if (!(GetWindowLongW( list[i], GWL_STYLE ) & WS_CHILD)) break;
|
||||
}
|
||||
HeapFree( GetProcessHeap(), 0, list );
|
||||
return ret;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue