Win32 window Owner vs window Parent?

后端 未结 4 565
离开以前
离开以前 2020-12-08 06:10

In Win32 programming, what is the difference between a window\'s parent and a window\'s owner? I thought I had it figured out, then I came across this code:

         


        
4条回答
  •  感情败类
    2020-12-08 06:54

    Ownership is a relationship between two top level windows while Parent is a relationship between a top level and a WS_CHILD, or a WS_CHILD and another WS_CHILD.

    The parent of a button is the form it is on, while a message box is owned by the form that showed it.

    Read this article from Microsoft Win32 Window Hierarchy and Styles to get a much clearer understanding of Ownership, Parenting, ZOrder, SetWindowLong, GetWindow and all the other nasty bits of the Win32 api for creating window relationships.

    EDIT: Looks like Microsoft took down that content, here is another reasonable summary of Ownership / Parenting.

提交回复
热议问题