diff --git a/win32/FireflyConfig/FireflyConfig.cs b/win32/FireflyConfig/FireflyConfig.cs
index 8dd9cec7..12c7b130 100644
--- a/win32/FireflyConfig/FireflyConfig.cs
+++ b/win32/FireflyConfig/FireflyConfig.cs
@@ -59,13 +59,14 @@ namespace FireflyConfig
private System.ServiceProcess.ServiceController scFirefly;
private ServiceStatus iState = ServiceStatus.Unintialized;
- private bool closeFromMenu = false;
private string strPort;
private string strServerName;
private string strMusicDir;
private string strPassword;
+ private bool ForceExit = false;
+
private System.IntPtr PipeHandle;
private System.IO.FileStream mPipeStream;
private byte[] PipeBuffer;
@@ -93,6 +94,15 @@ namespace FireflyConfig
private System.Windows.Forms.CheckBox checkBoxPassword;
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()
{
scFirefly.Refresh();
@@ -468,6 +478,7 @@ namespace FireflyConfig
this.Text = "Configuration";
this.WindowState = System.Windows.Forms.FormWindowState.Minimized;
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.groupBox1.ResumeLayout(false);
this.ResumeLayout(false);
@@ -502,7 +513,7 @@ namespace FireflyConfig
private void menuItemExit_Click(object sender, System.EventArgs e)
{
- closeFromMenu = true;
+ ForceExit = true;
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)]
diff --git a/win32/FireflyConfig/FireflyConfig.resx b/win32/FireflyConfig/FireflyConfig.resx
index 69a6ff9d..84cc3956 100644
--- a/win32/FireflyConfig/FireflyConfig.resx
+++ b/win32/FireflyConfig/FireflyConfig.resx
@@ -307,12 +307,12 @@
False
-
- False
-
FireflyConfig
+
+ False
+
8, 8