tags:

views:

272

answers:

1

[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.

+3  A: 

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;
John Knoeller
Thank you for your help.
whunmr
Why do you use an Win API call with P/Invoke? I think it is better to avoid these and look for a pure .NET class library solution.
Oliver Hanappi