Hi ,
My application is on tray mode when the form closing button is pressed.
class MyForm : Form
{
private System.Windows.Forms.NotifyIcon_notifyIcon;
private void MyForm_Closing(object sender,
System.ComponentModel.CancelEventArgs e)
{
e.Cancel = true;
this.Visible = false;
}
}
This might force the system not to shutdown.
When system is shutting down, the MyForm_Closing() is called, not
Application.Exit();
So, my application is just on tray mode and, the shutdown process is
stopped.
How to shutdown the application either when I am logging off or shutting
down the machine? I tried by handling the WM_QUERYENDSESSION messagewhere I
set a flag which indicates that call is for shutdown of machine and made
changes in the closing event handler as shown below but its not working.
private System.Windows.Forms.NotifyIcon_notifyIcon;
private void MyForm_Closing(object sender,
System.ComponentModel.CancelEventArgs e)
{ if(systemShutdown) {
e.Cancel = false;
} else { e.Cancel = true;
this.Visible = false; }
}
"Rami Saad" <ra*******@egdsc.microsoft.com> wrote in message
news:#i**************@TK2MSFTNGP09.phx.gbl...
Hi Kuldeep,
Most probably, this problem is caused by high memory usage. Your
application is using too much of the memory. But of course, that's most probably. It
might not be the case for you. So best thing is good debugging.
I would suggest to keep commenting chunks of your code per time, and
recompiling, and testing if the problem is still existing. And keep
minimizing your chunks to be able to track the problem.
--
Rami Saad
Microsoft GTSC Developer support for Middle East
"kuldeep" <ku*****@maximizelearning.com> wrote in message
news:uG**************@TK2MSFTNGP11.phx.gbl... Hi all,
I have a application developed in C# .net. The problem I face is I am
unable to shutdown my machine
when the exe is running. Windows is unable to close this exe an shut
down. Can anyone help.
Regards,
Kuldeep Pawar
Programmer,
Maximize Learning, Pune.
www.maximizelearning.com