Save and restore Aero Snap position on Windows 7

萝らか妹 提交于 2019-11-29 02:53:44

问题


Let's say I have a window and I want to save its position when the window closes and restore it when the window is opened again. The typical way to do this is to call GetWindowPlacement / SetWindowPlacement. This takes care of remember the position and the maximized / minimized state.

On Windows 7, you can dock a window to the side of the screen using the "Aero Snap" feature. My question is how do you save and restore windows that have been "Snapped" so that you can restore the "Snap" state. GetWindowPlacement / SetWindowPlacement does not solve this problem (to my knowledge) and I haven't seen any "Snap" API's in Windows 7.

There is a similar question on here How to detect window was resized by Windows7 but in this case it seems that the OP just wanted the restore position, not the "Snap" state.


回答1:


The workaround is to call GetWindowRect() to get the actual window coordinates and copy them over the bad coordinates in WINDOWPLACEMENT::rcNormalPosition.



来源:https://stackoverflow.com/questions/8368540/save-and-restore-aero-snap-position-on-windows-7

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