C
Claire
Windows refuses to close down if my applications main form is hidden and
there's a notify icon in the system tray. If I restore the form, then
shutting down Windows succeeds.
If I comment out the code in "frmOptions_Closing" then run and hide the
application, Windows shuts down normally.
I think there was a way to find out what was causing an application to close
down - api call? Is there anything in .net that I can query
My code is as follows
private void frmOptions_Resize(object sender, System.EventArgs e)
{
if (WindowState == FormWindowState.Minimized)
{
ShowInTaskbar = false;
Hide();
}
}
private void mnuOptions_Click(object sender, System.EventArgs e)
{
Show();
WindowState = FormWindowState.Normal;
ShowInTaskbar = true;
BringToFront();
}
private bool DOCLOSE = false;
private void mnuClose_Click(object sender, System.EventArgs e)
{
DOCLOSE = true;
Close();
}
private void frmOptions_Closing(object sender,
System.ComponentModel.CancelEventArgs e)
{
if (DOCLOSE == false)
{
e.Cancel = true;
WindowState = FormWindowState.Minimized;
}
}
private void cmdMinimize_Click(object sender, System.EventArgs e)
{
Close();
}
private void frmOptions_SizeChanged(object sender, System.EventArgs e)
{
if (WindowState == FormWindowState.Normal)
Settings.OptionBounds = Bounds;
}
there's a notify icon in the system tray. If I restore the form, then
shutting down Windows succeeds.
If I comment out the code in "frmOptions_Closing" then run and hide the
application, Windows shuts down normally.
I think there was a way to find out what was causing an application to close
down - api call? Is there anything in .net that I can query
My code is as follows
private void frmOptions_Resize(object sender, System.EventArgs e)
{
if (WindowState == FormWindowState.Minimized)
{
ShowInTaskbar = false;
Hide();
}
}
private void mnuOptions_Click(object sender, System.EventArgs e)
{
Show();
WindowState = FormWindowState.Normal;
ShowInTaskbar = true;
BringToFront();
}
private bool DOCLOSE = false;
private void mnuClose_Click(object sender, System.EventArgs e)
{
DOCLOSE = true;
Close();
}
private void frmOptions_Closing(object sender,
System.ComponentModel.CancelEventArgs e)
{
if (DOCLOSE == false)
{
e.Cancel = true;
WindowState = FormWindowState.Minimized;
}
}
private void cmdMinimize_Click(object sender, System.EventArgs e)
{
Close();
}
private void frmOptions_SizeChanged(object sender, System.EventArgs e)
{
if (WindowState == FormWindowState.Normal)
Settings.OptionBounds = Bounds;
}