0

In my windows application I have a Close button. While click on this it will call a function .

private void btClose_Click(object sender, EventArgs e)
{
  EndFormalities();
}

Is it possible to call the EndFormalities() function, while closing this application through Task manager . Any predefined Events available in Windows.NET ?

John Saunders
  • 160,644
  • 26
  • 247
  • 397
SabarishV
  • 13
  • 3
  • I have edited your title. Please see, "[Should questions include “tags” in their titles?](http://meta.stackexchange.com/questions/19190/)", where the consensus is "no, they should not". – John Saunders Nov 04 '14 at 05:51

1 Answers1

0

You can handle the WM_CLOSE message. Once you receive it, you can call your EndFormalities() method. Look at this answer on how to catch it: Handle WM_CLOSE message send to C# Tray App
Also read this one: Can I handle the killing of my windows process through the Task Manager?

Community
  • 1
  • 1
Michalis
  • 543
  • 1
  • 4
  • 10
  • I've tried with "override void WndProc" . But its not even triggered while Ending the application process through Task manager. – SabarishV Nov 04 '14 at 09:25