Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

capture the last WM_SIZE

Tags:

c++

resize

winapi

When I resize my window I want to tell another part of my program that my window has changed size. I read on MSDN that:

WM SIZE Message
The WM SIZE message is sent to a window after its size has changed.

However, I receive the WM_SIZE even when dragging. I noticed that there is also a WM_SIZING message that is sent when my window is resizing. At the moment I do not see the difference between WM_SIZE and WM_SIZING.

Is there some way I can capture the very last WM_SIZE message, as to not "spam" my program with resize messages?

like image 983
default Avatar asked May 09 '10 11:05

default


Video Answer


1 Answers

When you start dragging a window, the system enters a modal move/resize loop; it does not return to your own message loop until the drag action has finished. You are still getting WM_SIZE because it is sent directly to the window procedure, but it does not flow through your own message loop.

At the beginning of such a modal drag action, the system sends WM_ENTERSIZEMOVE to your window procedure. When you release the mouse button, your application will get WM_EXITSIZEMOVE. That is probably the message you want to trigger on.

like image 173
Thomas Avatar answered Sep 20 '22 01:09

Thomas