Determine how an application is closed
        Posted  
        
            by Mike_G
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Mike_G
        
        
        
        Published on 2010-03-19T19:25:09Z
        Indexed on 
            2010/03/19
            19:31 UTC
        
        
        Read the original article
        Hit count: 211
        
I am trying to determine if my application is closed through clicking the "X" on the windows form, or if they clicked an "Exit" button I have on it. Right now I am using StackTrace.GetFrame(someIndex) to determine how, but i am looking for a more definitive way since it looks like these frame orders arent guaranteed. Is there a better way to make the distinction? This is a .NET 3.5 WinForm, and Im writing in C#.
© Stack Overflow or respective owner