在 Windows 7 上保存和恢复 Aero Snap 位置 [英] Save and restore Aero Snap position on Windows 7

查看:20
本文介绍了在 Windows 7 上保存和恢复 Aero Snap 位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设我有一个窗口,我想在窗口关闭时保存它的位置,并在窗口再次打开时恢复它.执行此操作的典型方法是调用 GetWindowPlacement/SetWindowPlacement.这需要记住位置和最大化/最小化状态.

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.

在 Windows 7 上,您可以使用 "Aero Snap" 将窗口停靠在屏幕一侧 功能.我的问题是如何保存和恢复已捕捉"的窗口,以便您可以恢复捕捉"状态.GetWindowPlacement/SetWindowPlacement 没有解决这个问题(据我所知),我在 Windows 7 中没有看到任何Snap"API.

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.

这里有一个类似的问题如何检测 Windows7 调整了窗口大小 但在这种情况下看来 OP 只是想要恢复位置,而不是捕捉"状态.

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.

推荐答案

解决方法是调用 GetWindowRect() 来获取实际的窗口坐标并将它们复制到 WINDOWPLACEMENT 中的坏坐标上::rcNormalPosition.

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

这篇关于在 Windows 7 上保存和恢复 Aero Snap 位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆