mirror of
https://github.com/kangyu-california/PersistentWindows.git
synced 2025-05-11 13:05:38 +02:00
add command option -hotkey to allow customization, such as -hotkey "Q", change default hotkey to (Alt+)W
This commit is contained in:
parent
307963f851
commit
466517da1e
3 changed files with 32 additions and 17 deletions
|
@ -11,12 +11,12 @@ namespace PersistentWindows.SystrayShell
|
|||
{
|
||||
static HotKeyWindow hkwin = null;
|
||||
|
||||
public static void Start()
|
||||
public static void Start(uint hotkey)
|
||||
{
|
||||
Thread messageLoop = new Thread(() =>
|
||||
{
|
||||
hkwin = new HotKeyWindow();
|
||||
Application.Run(new HotKeyForm());
|
||||
hkwin = new HotKeyWindow(hotkey);
|
||||
Application.Run(new HotKeyForm(hotkey));
|
||||
})
|
||||
{
|
||||
Name = "MessageLoopThread",
|
||||
|
@ -26,10 +26,10 @@ namespace PersistentWindows.SystrayShell
|
|||
messageLoop.Start();
|
||||
}
|
||||
|
||||
public HotKeyForm()
|
||||
public HotKeyForm(uint hotkey)
|
||||
{
|
||||
//InitializeComponent();
|
||||
var r = User32.RegisterHotKey(this.Handle, 0, (int)User32.KeyModifier.Alt, 0x51); // Register Alt + Q
|
||||
var r = User32.RegisterHotKey(this.Handle, 0, (int)User32.KeyModifier.Alt, hotkey); // Register Alt + W
|
||||
}
|
||||
|
||||
protected override void WndProc(ref Message m)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue