INF: How to Change a Window's Parent

ID Number: Q12172

2.00 2.03 2.10 3.00 3.10

WINDOWS

Summary:

The following information describes how to change a window's parent in

Windows versions 2.x and 3.x.

The correct way to do this in Windows versions 2.x is to destroy the

child and then re-create the child with the proper handle to the

parent. The following steps can be used to do this:

1. Do a ShowWindow(hWnd, HIDE_WINDOW) call.

2. Change the handle to the child using the SetWindowWord function.

3. Do a ShowWindow(hWnd, SHOW_WINDOW) call.

Note: Microsoft does not recommend that this method be used, and it is

not guaranteed to work in future releases of Windows.

In Windows versions 3.x, the SetParent function should be used to set

the parent of a window.

Additional reference words: TAR57085 2.00 2.03 2.10 2.x 3.00 3.10 3.x