Win32 C++ - Check if the Window PositionX/PositionY and Width/Height changed

别说谁变了你拦得住时间么 提交于 2019-12-02 23:16:57

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!