Form Closing event - again

  • Thread starter Thread starter John S
  • Start date Start date
J

John S

I need to know if the "X" in the upper right-hand corner of the form was
pressed to close a form. Nothing else, just the "X" close button
 
You might try setting a flag in your other means of closing the form
(like a close button).

Chad
 
if you are interested only in trapping X button do this

protected override void WndProc(ref System.Windows.Forms.Message m)
{
if(m.Msg == 0x0010) //X button
{
MessageBox.Show("Yeah i am close button here");
}
base.WndProc(ref m);
}
 
Back
Top