How to find out whether a window was resized using Aero Snap feature? GetWindowPlacement
function gives the latest "restored" window size. I use it as follows:
WINDOWPLACEMENT wp = {};
wp.length = sizeof(WINDOWPLACEMENT);
::GetWindowPlacement( hWnd, &wp );
For instance, it gives wp.rcNormalPosition = {top=208 bottom=520 left=152 right=510}
, when it should be
{top=0 bottom=1920 left=152 right=510}
.
Please, note that That was my fault, GetWindowRect
gives exactly the same incorrect result.GetWindowRect
gives the right result.
I need to save window state on the program exit and load it on start, so I need to know how windows are placed. How can I find out actual window coordinates?
Well, I made several tests with notepad.exe
(and some other standard Windows components) and it saves its state in the same way — it doesn't remember whether it was "snapped". So I suppose this is intended behavior of Windows programs.
GetClientRect
give? If the client size is larger than the window size, that's a clue that something is amiss. What aboutDWMWA_EXTENDED_FRAME_BOUNDS
, which is mentioned in theGetWindowRect
comments as helpful for getting the bounds of an Aero window? – Relationship