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);
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Win Form.Close Handler 2
Form closing event ? 1
What event is fired 4
Stop form from closing 6
How can I stop a windows Media player pop up on my PC 3
Form and "X" button 8
Event on close 8
Close form 3

Back
Top