问题
It is possible to check whenever the X/Y position of the window changed? Also, if it's possible to check if the Window Width/Height changed too.
回答1:
You're looking for the WM_MOVE and WM_SIZE messages.
回答2:
As already answered, you can handle WM_SIZE and WM_MOVE. But you can also intercept the messages before they have any effect by checking WM_WINDOWPOSCHANGING (except in the case where a call to SetWindowPos passes SWP_NOSENDCHANGING - but that is usually deliberate and completely under your control). This message is useful for cleanly handling window size/position restrictions or doing window snapping. If you force stuff to happen during WM_SIZE or WM_MOVE you will get flickering etc.
来源:https://stackoverflow.com/questions/11713728/win32-c-check-if-the-window-positionx-positiony-and-width-height-changed