14. März 2007

Events aus der WindowsMessageQueue direkt behandeln

protected override void WndProc(ref Message m)

{

// Werte aus winuser.h

System.IntPtr SC_MINIMIZE = new IntPtr(0xF020);

System.IntPtr SC_MAXIMIZE = new IntPtr(0xF030);

System.IntPtr SC_RESTORE= new IntPtr(0xF120);

if (m.WParam == SC_MINIMIZE)

{

if (this.WindowState!=FormWindowState.Maximized)

sizeBeforeMin=this.Size;

}

if (m.WParam == SC_MAXIMIZE)

{

sizeBeforeMin=this.Size;

}

if (m.WParam ==SC_RESTORE )

{

System.Diagnostics.Debug.WriteLine("WNDPROC wieder");

}

base.WndProc (ref m);

}

Keine Kommentare: