I see on MSDN, he said:
If the created window is a child window , its default position is at the bottom of the Z-order . If the created window is a top-level window, its default position is at the top of the Z-order (but below all upper windows, unless the created window is the topmost). ( http://msdn.microsoft.com/en-us/library/windows/desktop/ms632680(v=vs.85).aspx )
However, another documentation says: When an application creates a window, the system places it at the top of the z-order for windows of the same type ( http://msdn.microsoft.com/en-us/library/windows/desktop/ms632599 ( v = vs. 85) .aspx )
And as I tested it,
btn1 = ::CreateWindow(L"button", L"OK", WS_TABSTOP|BS_DEFPUSHBUTTON|WS_VISIBLE|WS_CHILD , 10, 10, 50, 30, hWnd, (HMENU)51, hInst, NULL); btn2 = ::CreateWindow(L"button", L"Cancel", WS_TABSTOP|WS_CHILD|BS_PUSHBUTTON|WS_VISIBLE , 20, 20, 70, 30, hWnd, (HMENU)52, hInst, NULL);
a newly created child window (for example: I created two buttons in the window, and they overlapped, I see that the button created later closes the first created button)
This is the first statement in MSDN that contradicts my testing.
source share