Setting some windows relations.

John Found johnfound at
Thu Nov 19 13:07:13 CST 2015

Hi All.
I am developing in Linux a GUI toolkit, that has port for Windows and I test in under WINE.
Surprisingly, I stuck on two problems that look different, but probably has the same origin.

The first is the setting of the owner window for the modal dialogs. In Windows it is common practice
to set it through SetWindowLong with GWL_HWNDPARENT and it works - the owner window stay always under the .

In WINE, setting the owner this way does not work. The owner window can be raised above the modal dialog. 
On the other hand, setting the hWndParent in CreateWindowEx works as intended. 

The problem is that when I create the dialog window I don't know the owner window I will use later and it
can change during program execution.

The second problem is with the windows that have to change from WS_POPUP to WS_OVERLAPPED and back by the
same SetWindowLong.
When I create a window as WS_OVERLAPPED and then change the style to WS_POPUP, the window looks like WS_POPUP, 
but does not behave as such. For example in Linux it has override_redirect=0, steals the focus from the main window, etc.
When the window is created initially with WS_POPUP, nothing of this happens.

Again in Windows, changing the style by SetWindowLong works as intended.

Is there some simple workaround of these problems? In order to fight it I must redesign the whole library in
order to create the windows with the right parameters. Some of the features I want to make need to destroy the
windows and recreate them instead of simply change the needed parameters.

John Found <johnfound at>

More information about the wine-devel mailing list