http://msdn.microsoft.com/en-us/library/ms632653(VS.85).aspx
I want to get the size of a window being resized (I will show a tooltip by the mouse).
I have the code below:
protected override void WndProc(ref Message m)
{
base.WndProc(ref m);
if (m.Msg == WM_WINDOWPOSCHANGING)
{
WindowPos mwp;
mwp = (WindowPos)Marshal.PtrToStructure(m.LParam, typeof(WindowPos));
//mwp.flags = mwp.flags | 1; // 1 is the NOSIZE flag
if (mwp.x != 0
&& mwp.hwnd != this.handle
&& mwp.hwndInsertAfter != this.handle)
MessageBox.Show(mwp.cx.ToString() + " x " + mwp.cy.ToString());
m.Result = (IntPtr)0;
}
}
public struct WindowPos
{
public IntPtr hwnd;
public IntPtr hwndInsertAfter;
public int x;
public int y;
public int cx;
public int cy;
public uint flags;
};
I think I have to set a hook for it, but I am unsure of how to. Any help would help a lot.
Thanks.