Original address:
http://blog.163.com/cumt_xl/blog/static/19071504420136911838683/
Q:What is a top-level window?
a: a top-level window is a window, which is not child, i.e. it had not ws_child style set.
Notes
- Unlike the child Windows, a top-level window can be displayed anywhere on the screen;
- Many definitions state, a top-level window is "A window This has no parent";
That's correct but can leads in a confusion:many people think the every window which is created passing a valid hWnd Parent in CreateWindow (Ex) "had a parent" then, according to the definition it was not top-level;
In fact hwndparent is either a handle to parent or owner window;
If hwndparent is a valid window handle and Ws_child style are not set, then we have a top-level owned window ;
- A top-level window can or can not being owned but was never a child; Further we can say that it can having an owner but never has a parent.
- top-level windows can be either overlapped Windows (have ws_overlapped style and generally used as app Lication main window) or popup windows (have ws_popup style, usually temporary windows like message boxes and D Ialogs);
- The coordinates used in CreateWindow (Ex), MoveWindow, SetWindowPos, and so on is always scren coordinates (relative to P-left corner of the screen).
Windows API-----Top Level window