Added: system shut down support

This commit is contained in:
Ray 2020-11-21 00:14:03 +00:00
parent 1577dcc24e
commit 40e5f65e57

View File

@ -26,6 +26,7 @@ namespace AppLauncher
//protected const int MOD_SHIFT = 0x4;
//protected const int MOD_WIN = 0x8;
protected const int WM_HOTKEY = 0x312;
protected const int WM_QUERYENDSESSION = 0x0011;
protected OptionsForm optionsForm = null;
protected string sessionFilename = null;
@ -127,17 +128,25 @@ namespace AppLauncher
protected override void WndProc(ref Message m)
{
base.WndProc(ref m);
if (m.Msg != WM_HOTKEY) return;
switch (m.WParam.ToInt32())
switch (m.Msg)
{
case 1:
this.Visible = !this.Visible;
case WM_HOTKEY:
if (m.WParam.ToInt32() == 1)
{
this.Visible = !this.Visible;
}
break;
case WM_QUERYENDSESSION:
requestExit = true;
this.Close();
break;
default: break;
}
base.WndProc(ref m);
}
public LauncherSession CurrentSession { get; set; } = null;