Fix the logoff/shutdown bug.

This commit is contained in:
Ron Pedde 2006-05-06 02:35:45 +00:00
parent 63b021a47e
commit 4f01d784dc
2 changed files with 22 additions and 5 deletions

View File

@ -59,13 +59,14 @@ namespace FireflyConfig
private System.ServiceProcess.ServiceController scFirefly; private System.ServiceProcess.ServiceController scFirefly;
private ServiceStatus iState = ServiceStatus.Unintialized; private ServiceStatus iState = ServiceStatus.Unintialized;
private bool closeFromMenu = false;
private string strPort; private string strPort;
private string strServerName; private string strServerName;
private string strMusicDir; private string strMusicDir;
private string strPassword; private string strPassword;
private bool ForceExit = false;
private System.IntPtr PipeHandle; private System.IntPtr PipeHandle;
private System.IO.FileStream mPipeStream; private System.IO.FileStream mPipeStream;
private byte[] PipeBuffer; private byte[] PipeBuffer;
@ -93,6 +94,15 @@ namespace FireflyConfig
private System.Windows.Forms.CheckBox checkBoxPassword; private System.Windows.Forms.CheckBox checkBoxPassword;
private System.ComponentModel.IContainer components; private System.ComponentModel.IContainer components;
protected override void WndProc(ref Message msg)
{
if(msg.Msg == 0x11) // WM_QUERYENDSESSION
{
ForceExit = true;
}
base.WndProc(ref msg);
}
public void ServiceStatusUpdate() public void ServiceStatusUpdate()
{ {
scFirefly.Refresh(); scFirefly.Refresh();
@ -468,6 +478,7 @@ namespace FireflyConfig
this.Text = "Configuration"; this.Text = "Configuration";
this.WindowState = System.Windows.Forms.FormWindowState.Minimized; this.WindowState = System.Windows.Forms.FormWindowState.Minimized;
this.Resize += new System.EventHandler(this.FireflyConfig_Resize); this.Resize += new System.EventHandler(this.FireflyConfig_Resize);
this.Closing += new System.ComponentModel.CancelEventHandler(this.FireflyConfig_Closing);
this.Load += new System.EventHandler(this.FireflyConfig_Load); this.Load += new System.EventHandler(this.FireflyConfig_Load);
this.groupBox1.ResumeLayout(false); this.groupBox1.ResumeLayout(false);
this.ResumeLayout(false); this.ResumeLayout(false);
@ -502,7 +513,7 @@ namespace FireflyConfig
private void menuItemExit_Click(object sender, System.EventArgs e) private void menuItemExit_Click(object sender, System.EventArgs e)
{ {
closeFromMenu = true; ForceExit = true;
Close(); Close();
} }
@ -612,6 +623,12 @@ namespace FireflyConfig
} }
} }
private void FireflyConfig_Closing(object sender, System.ComponentModel.CancelEventArgs e)
{
if(!ForceExit)
e.Cancel = true;
}
} }
[StructLayout(LayoutKind.Sequential)] [StructLayout(LayoutKind.Sequential)]

View File

@ -307,12 +307,12 @@
<data name="$this.TrayLargeIcon" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <data name="$this.TrayLargeIcon" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value> <value>False</value>
</data> </data>
<data name="$this.Localizable" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</data>
<data name="$this.Name"> <data name="$this.Name">
<value>FireflyConfig</value> <value>FireflyConfig</value>
</data> </data>
<data name="$this.Localizable" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</data>
<data name="$this.GridSize" type="System.Drawing.Size, System.Drawing, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <data name="$this.GridSize" type="System.Drawing.Size, System.Drawing, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>8, 8</value> <value>8, 8</value>
</data> </data>