First, sorry for my bad english :)
Second, I can know when the form is being moved/resized, using this code:
protected override void WndProc(ref Message m)
{
if (m.Msg == WM_WINDOWPOSCHANGING)
{
WINDOWPOS winPos = new WINDOWPOS();
winPos = (WINDOWPOS)Marshal.PtrToStructure(m.LParam, typeof(WINDOWPOS));
//Here I just need to change the values of the WINDOWPOS structure
Marshal.StructureToPtr(winPos, m.LParam, true);
}
}
The WM_WINDOWPOSCHANGING message is sent also when the user is minimizing or maximizing the window. But how I can know when the user is maximizing/minimizing, not moving/resizing? I tried get the WindowState property, but it didn't work :(
The code of the WINDOWPOS structure is:
[StructLayout(LayoutKind.Sequential)]
public struct WINDOWPOS
{
public IntPtr hwnd;
public IntPtr hwndInsertAfter;
public int x;
public int y;
public int cx;
public int cy;
public int flags;
}
Any help?