mirror of
https://github.com/kangyu-california/PersistentWindows.git
synced 2025-05-12 13:35:39 +02:00
#331, Ctrl + Win + Toggle Webpage Commander to unregister hotkey
This commit is contained in:
parent
2c31ed0002
commit
a0fc8711f8
2 changed files with 23 additions and 3 deletions
|
@ -4,6 +4,7 @@ using System.Windows.Forms;
|
||||||
|
|
||||||
using PersistentWindows.Common;
|
using PersistentWindows.Common;
|
||||||
using PersistentWindows.Common.WinApiBridge;
|
using PersistentWindows.Common.WinApiBridge;
|
||||||
|
using PersistentWindows.Common.Diagnostics;
|
||||||
|
|
||||||
namespace PersistentWindows.SystrayShell
|
namespace PersistentWindows.SystrayShell
|
||||||
{
|
{
|
||||||
|
@ -11,13 +12,15 @@ namespace PersistentWindows.SystrayShell
|
||||||
{
|
{
|
||||||
static HotKeyWindow hkwin = null;
|
static HotKeyWindow hkwin = null;
|
||||||
static Thread messageLoop;
|
static Thread messageLoop;
|
||||||
|
static HotKeyForm hkf = null;
|
||||||
|
|
||||||
public static void Start(uint hotkey)
|
public static void Start(uint hotkey)
|
||||||
{
|
{
|
||||||
messageLoop = new Thread(() =>
|
messageLoop = new Thread(() =>
|
||||||
{
|
{
|
||||||
hkwin = new HotKeyWindow(hotkey);
|
hkwin = new HotKeyWindow(hotkey);
|
||||||
Application.Run(new HotKeyForm(hotkey));
|
hkf = new HotKeyForm(hotkey);
|
||||||
|
Application.Run(hkf);
|
||||||
})
|
})
|
||||||
{
|
{
|
||||||
Name = "MessageLoopThread",
|
Name = "MessageLoopThread",
|
||||||
|
@ -27,6 +30,12 @@ namespace PersistentWindows.SystrayShell
|
||||||
messageLoop.Start();
|
messageLoop.Start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void Stop()
|
||||||
|
{
|
||||||
|
if (messageLoop.IsAlive)
|
||||||
|
messageLoop.Abort();
|
||||||
|
}
|
||||||
|
|
||||||
public HotKeyForm(uint hotkey)
|
public HotKeyForm(uint hotkey)
|
||||||
{
|
{
|
||||||
//InitializeComponent();
|
//InitializeComponent();
|
||||||
|
@ -54,6 +63,7 @@ namespace PersistentWindows.SystrayShell
|
||||||
else if (m.Msg == 0x0010 || m.Msg == 0x0002)
|
else if (m.Msg == 0x0010 || m.Msg == 0x0002)
|
||||||
{
|
{
|
||||||
r = User32.UnregisterHotKey(this.Handle, 0);
|
r = User32.UnregisterHotKey(this.Handle, 0);
|
||||||
|
Log.Event($"unregister hotkey {r}");
|
||||||
}
|
}
|
||||||
|
|
||||||
base.WndProc(ref m);
|
base.WndProc(ref m);
|
||||||
|
|
|
@ -342,9 +342,19 @@ namespace PersistentWindows.SystrayShell
|
||||||
}
|
}
|
||||||
|
|
||||||
private void WebCommander(object sender, EventArgs e)
|
private void WebCommander(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if ((User32.GetKeyState(0x5b) & 0x8000) != 0 //left window logo key pressed
|
||||||
|
&& (User32.GetKeyState(0x11) & 0x8000) != 0) //ctrl key pressed
|
||||||
|
{
|
||||||
|
//this.invokeWebCommander.Enabled = false;
|
||||||
|
this.invokeWebCommander.Visible = false;
|
||||||
|
HotKeyForm.Stop();
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
HotKeyForm.InvokeFromMenu();
|
HotKeyForm.InvokeFromMenu();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void ToggleIcon(object sender, EventArgs e)
|
private void ToggleIcon(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue