Click here to Skip to main content
13,195,146 members (69,295 online)
Click here to Skip to main content
Add your own
alternative version

Tagged as


Posted 6 Jul 2011

All about owned windows

, 6 Jul 2011
Rate this:
Please Sign up or sign in to vote.
This tip, taken from MSDN tells the basic of ownership in windows.
Ownership is a pretty important concept when it comes to windows and I had a pretty hard time finding this info in MSDN; so just posting it here for those who are as bad as me at searching information.

An overlapped or pop-up window can be owned by another overlapped or pop-up window. Being owned places several constraints on a window.

An owned window is always above its owner in the z-order.
The system automatically destroys an owned window when its owner is destroyed.
An owned window is hidden when its owner is minimized.
Only an overlapped or pop-up window can be an owner window; a child window cannot be an owner window. An application creates an owned window by specifying the owner's window handle as the hwndParent parameter of CreateWindowEx when it creates a window with the WS_OVERLAPPED or WS_POPUP style. The hwndParent parameter must identify an overlapped or pop-up window. If hwndParent identifies a child window, the system assigns ownership to the top-level parent window of the child window. After creating an owned window, an application cannot transfer ownership of the window to another window.

Dialog boxes and message boxes are owned windows by default. An application specifies the owner window when calling a function that creates a dialog box or message box.

An application can use the GetWindow function with the GW_OWNER flag to retrieve a handle to a window's owner.

Here is a link to a nice blog about parent and owner:[^]


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Mukit, Ataul
Chief Technology Officer Rational Technologies
Bangladesh Bangladesh
If you are not in - you are out !
- Chapter 1

You may also be interested in...


Comments and Discussions

-- There are no messages in this forum --
Permalink | Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.171019.1 | Last Updated 7 Jul 2011
Article Copyright 2011 by Mukit, Ataul
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid