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.
Snap with Snap Assist To use Snap Assist, click the thumbnail of the window you want to open. If you have two windows displayed side-by-side, you can resize both windows simultaneously by selecting and dragging the dividing line.
Aero Snap: Dragging a window to the right or left side of the desktop causes the window to fill the respective half of the screen. Snapping a window to the top of the screen maximizes it.
The workaround is to call GetWindowRect()
to get the actual window coordinates and copy them over the bad coordinates in WINDOWPLACEMENT::rcNormalPosition
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With