Some observations on window parentage etc.

Medland, Bill Bill.Medland at accpac.com
Thu Aug 15 10:58:41 CDT 2002


Here are some observations with regard to Window parentage/ownership etc.

Clearlt Microsoft documentation is quite out of date and contradictory on
the subject these days so we are going to have to experiment and find out
what actually happens.

We also are going to have to be careful about terminology and not jumping to
conclusions.  I mean what ther heck are we supposed to think when Spy++
shows a window as a top-level window (by which I mean just below the desktop
in the listview that Spy++ uses), tells us that its parent is its owner (a
different top-level window) but that "parent" says it has no children.

So.

1. GetParent does not necessarily return the same value as GetWindowLong
(GWL_HWNDPARENT).  I have seen GetParent returning 0 while GetWindowLong
returns the same non zero value as GetWindow (GW_OWNER).

2. GetAncestor (GA_PARENT) seems to be the best way to get the "true
parent".

3. WIN_CreateWindowEx is currently slightly wrong.  I know MSDN says don't
mix WS_POPUP and WS_CHILD but if you do then the result is wrong, I believe.
However I am loth to fix it and submit the patch because  that really messes
everything else up so I guess we need a bigger patch first.  (Heck, even
under windows 98 you can get the kernel to fall over rather easily this
way).

4. I don't like the look of GetAncestor (GA_ROOTOWNER).  The MSDN
documentation suggests that it should return the result of recursively
calling GetParent (or should it be recursively calling GetWindowLong
(GWL_HWNDPARENT) whereas GetAncestor (GA_ROOT) should return the result of
recursively calling GetAncestor (GA_PARENT) (each stopping just before the
desktop, of course). (And of course that is definition, not necessarily
mechanism)

More to follow.

Bill



More information about the wine-devel mailing list