I try to perform some actions in the program when the user closes the session.
Here is the code:
using System; using System.Diagnostics; using Microsoft.Win32; using System.Windows.Forms; using System.Threading; public class MyProgram { static Process myProcess = null; public MyProgram() { }
I open the application, it opens notepad. When I close the session:
If I did not modify anything in the notebook (so this does not need confirmation when exiting), SO closes the notebook and the SessionEnding event (so in this case it is normal) and Process.Exited later.
If I changed something in the notebook, the notebook will ask me if I want to save, and my event will not be fired until the notebook process is closed.
In other words, my program receives a notification only when the process starts. I want my event to be raised in any situation, whether the process is open or not.
Thanks in advance.
Rbn3d source share