Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to detect window was resized by Windows7

Tags:

.net

windows-7

[Question]

1. How to detect the window (WPF) was resized by Aero Snap? then i can ignore the new size and position.

Thanks for your answer and comments in advance.

like image 895
whunmr Avatar asked Oct 15 '22 11:10

whunmr


1 Answers

On exit, Call GetWindowPlacement. This will return the current window size and position, and whether you are minimized, maximized or restord, it will also give you the latest 'restored' window size and position.

So you don't have to track changes to your window position, just ask when you need it.

typedef struct _WINDOWPLACEMENT {
    UINT length;
    UINT flags;
    UINT showCmd;
    POINT ptMinPosition;
    POINT ptMaxPosition;
    RECT rcNormalPosition;
} WINDOWPLACEMENT;
like image 109
John Knoeller Avatar answered Oct 18 '22 13:10

John Knoeller