keep cc'ing wine-devel please
"Medland, Bill" Bill.Medland@accpac.com wrote:
Could you please test patch posted by Bill Medland to wine-patches today? It's not entirely correct though. My tests show that SetWindowLong(GWL_HWNDPARENT) call changes simultaneously both parent and owner for top level windows and returns old value (not sure old owner or parent it is).
Even if the window is not in fact a child?
Yes. According to my test program.
Please excuse my ignorance here; I am still a little shaky on terminology. Surely if it is a top level window then its parent is the desktop and always will be.
Or are you saying that it reparents to the desktop (and so the problem is down in the SetParent code)?
I don't see a reparenting to desktop in the relay trace.
But top level windows created by Visual Vasic are special: they have no parent, but only owner according to Spy++. In my tests I can't reproduce it yet.
So you suspect that Spy++ is not telling the truth? (It wouldn't be the first time)
I incline to trust Spy++ here. It correctly shows paerent/owner for my test application playing with SetParent/SetWindowLong. It seems that Windows always sets 0 in the parent field if the parent is desktop. Even after explicit SetParent(GetDesktopWindow()) or SetWindowLong(GWL_HWNDPARENT, GetDesktopWindow()) GetWindowLong(GWL_HWNDPARENT)/GetWindow(GW_OWNER) return 0 in my tests.
A bit of investigation of Wine source revealed that some places use GetAncestor(hwnd, GA_PARENT), while others use GetParent(hwnd).
And, in the case of WIN_CreateWindowEx, GetAncestor (hwnd, GA_ROOT)
Since their behaviour is different in respect of top level and child windows, some major clean up in that area in Wine is needed.
Careful.
In our particular case, according to Spy++ the owner of the ThunderRT6FormDC is a third-generation window. viz. the actual window requested, not one of its ancestors.
i.e. I see the call to SetWindowLong (30056 (The ThunderRT6FormDC), -8, 10046 (The ThunderRT6UserControlDC))
I guess an important point here is that in our case the Visual Basic is an OCX sitting inside a container and so the ThunderRT6UserControlDC is not first generation.
Now I don't understand your terminology. parent - child - sibling are the termings in the Windows world. Who of them was born earlier matters only when Z order and visibility are taken into account (and can be easily changed).