Win32 C ++ - do something when the window is restored, what message?

So, I have a dialog application using pure WinAPI. There is a main dialog box, and then a few other dialogs, which are tool windows. These tool windows are designed for free placement, the user can drag them, hide them and show them, but they do not have a taskbar entry. This is what I intended, but the problem is that when I switch from the main window to another application, then click on the taskbar title for the main window, the main window will appear, but this will not happen in the tool windows. They remain hidden behind the main window, and sometimes with the windows of other applications, and you cannot use them until you move all the topmost windows and pull out the window tool.

So, what I'm trying to do to get around this, when the user restores the window from a minimum, I want to list all the tool windows and bring them to the forefront, perhaps by calling SetActiveWindow() .

But what message is sent when restoring a window? I thought WM_SHOW or WM_RESTORE, but they do not exist.

Another question, and if you answer this question, the first question does not matter, because I will no longer need to use this workaround: is there a better way to bring all the tool windows to the front?

+4
source share
2 answers

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

+5
source

The naive answer to the question is to listen to WM_SIZE and respond to wParam value SIZE_RESTORED .

Another obvious possibility is that all tool windows belong to the main window. While you are happy that the tool windows will always be on top of the main window, this will solve your problem. Windows owned by the owners will be hidden when the owner is minimized and re-displayed when the owner is restored.

Read more about ownership in the MSDN topic in Window Properties .

+4
source

Source: https://habr.com/ru/post/1439673/


All Articles