Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Win32 C++ - Do something when window is restored, which message?

Tags:

windows

winapi

So, I have a dialog based application using pure WinAPI. There is a main dialog, and then multiple other dialogs that are toolwindows. These toolwindows are meant to free-float around, the user can drag them, hide them, and show them, but they have no taskbar entry. This is what I intended, but the problem is, when I switch from the main window to a different application, then click on the taskbar entry for the main window, the main window will show up, but the toolwindows will not. They stay hidden behind the main window and sometimes windows of other applications, and you cannot use them until you move all of the top-most windows and hunt down the toolwindow.

So, what I'm trying to do to work around this is, when the user restores the window from being minimized, I want to enumerate through all of the tool windows and bring them to the front, maybe by calling SetActiveWindow().

But what message gets sent when the window is restored? I was thinking WM_SHOW, or WM_RESTORE, but they don't exist.

Another question, and if you answer this the first question is irrelevant because I will no longer need to use that workaround: Is there a better method of bringing all tool-windows to the front?

like image 454
Brandon Miller Avatar asked Jan 16 '23 07:01

Brandon Miller


1 Answers

Give the tool windows the WS_POPUP style (and not WS_OVERLAPPED), and make the main window their parent (strictly it is their owner window). That way the tool windows will remain on top of the main window. This may (or may not) be what you want.

like image 119
bobbogo Avatar answered May 11 '23 16:05

bobbogo