We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

include how to tell if windows is trying to close the application or if the user is.

Thread ID:





4408 May 12,2003 12:23 AM UTC May 30,2003 01:07 PM UTC WinForms 2
Tags: FAQ
Asked On May 12, 2003 12:23 AM UTC

Your post about Setting a Form to Be Invisible at Its Inception was very helpful to me although it lacked the answer to that question. I have a program that can only be closed using the notify icon in the taskbar. The closed event is cancelled. I need to use application.exit() there but only when windows is trying to close the app to restart the computer.

Ramesh Praveen [Syncfusion]
Replied On May 13, 2003 12:39 PM UTC

Maybe the Application.ApplicationExit will get called before your Closing event? -Praveen

Administrator [Syncfusion]
Replied On May 30, 2003 01:07 PM UTC

This is what I had to do: public static void ShuttingDown() { StackTrace Trace = new StackTrace(true); if(Trace.FrameCount > 13) { if(Trace.GetFrame(14).GetMethod().Name=="WmSysCommand") { e.Cancel=true; this.Visible=false; } } }


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon