From 3defd0e6c0c765aa70ad5e80456555f43c4c0e6e Mon Sep 17 00:00:00 2001 From: Robin Date: Tue, 18 Oct 2016 21:28:57 +0200 Subject: [PATCH] BUG-2043: Fix for a weird combination of windows messages. [skip ci] --- GreenshotPlugin/Controls/HotkeyControl.cs | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/GreenshotPlugin/Controls/HotkeyControl.cs b/GreenshotPlugin/Controls/HotkeyControl.cs index 0e40a9cbc..af12f6d93 100644 --- a/GreenshotPlugin/Controls/HotkeyControl.cs +++ b/GreenshotPlugin/Controls/HotkeyControl.cs @@ -512,18 +512,21 @@ namespace GreenshotPlugin.Controls { /// /// true if the message was handled public static bool HandleMessages(ref Message m) { - if (m.Msg == WM_HOTKEY) { - // Call handler - if (IsWindows7OrOlder) { - KeyHandlers[(int)m.WParam](); - } else { - if (EventDelay.Check()) { - KeyHandlers[(int)m.WParam](); - } - } + if (m.Msg != WM_HOTKEY) + { + return false; + } + // Call handler + if (!IsWindows7OrOlder && !EventDelay.Check()) + { return true; } - return false; + HotKeyHandler handler; + if (KeyHandlers.TryGetValue((int)m.WParam, out handler)) + { + handler(); + } + return true; } public static string GetKeyName(Keys givenKey) {