Thank you for your response.
I ' m trying to send WM_QUIT before send WM_CLOSE,when a user click on X ,but only when he close the main window . This is a ugly patch that prevent visual studio 6 to crash if a menu is opened and user click on X .
That way I need to know if the hwnd from handle_wm_protocols() is the one of the main window or not , cause I need to send WM_QUIT only if user close his main program window.

On Mon, Oct 10, 2016 at 9:07 PM, Ken Thomases <ken@codeweavers.com> wrote:
I'm CC'ing the list.  Please keep the discussion on the list.

On Oct 10, 2016, at 12:26 PM, A B <dianaxxyyzz@gmail.com> wrote:
>
> If we run the command: wine program.exe , does wine save the hwnd of the main window for the program.exe ? And how to get it ? For example if I want to printf in wine logs ,the hwnd of the main window of program.exe , is this hwnd saved somewhere in a wine variable ?

The concept of "main window" of a program is purely a human interpretation.  There's no such concept in the Win32 API.  Therefore, there's no specific variable in Wine which holds the "main" window's handle.

You can collect a +win debug log and you'll see the window handle of all of the windows created by the program (along with a lot of activity related to them).  It's up to you to determine which is the main window.

-Ken