Problem handling the window messages!

I wrote this code:

private const intWM_NCLBUTTONDOWN= 0xA1;
private const intWM_NCLBUTTONUP= 0xA2;

protectedoverride voidDefWndProc(ref Message m)
{
if (m.Msg ==WM_NCLBUTTONDOWN)
{
return;
}
}
else if (m.Msg ==WM_NCLBUTTONUP)
{
return;
}
}

base.DefWndProc(ref m);
}

protectedoverride voidWndProc(ref Message m)
{
if (m.Msg ==WM_NCLBUTTONDOWN)
{
return;
}
}
else if (m.Msg ==WM_NCLBUTTONUP)
{
return;
}
}

base.WndProc(ref m);
}

I was going to write a realevent handler forminimize button click.


When you click the minimize button, a message with the (Msg == 161) and(WParam == 8(it shows that mouse is on minimize button)) is sent to the window that defines the press event for it, and as I read in MSDN, a message that would be the release event of the button would be sent to the window with(Msg == 162) and(WParam == 8)but the MSDN saies that if a window has captured the mouse, this message would not be sent to it!


I use .Net 2.0 and C# 2.0, and I tried so many things like this.Capture = false in any part of the code, Used the MouseDown event handler(it works just when you click in theclientAreaof the window!) and evenMessageFilter class andApplication.AddMessageFilter() but I coulden't do what I want.
And I'm sure it's because of the mouse capture of the window, because when I filter/ignore theWM_NCLBUTTONDOWN message, and so the capture does not start, theWM_NCLBUTTONUP would be sent to the window and the event that I wrote, raises
!


Could anyone help please!

[3622 byte] By [sojaner] at [2007-12-24]