public static void RegisterHotKey(CaptureMode mode) { if (Handle == IntPtr.Zero) { return; } if (!HotKeys.ContainsKey(mode)) { return; } var hotKey = HotKeys[mode]; if (hotKey == null) { return; } if (hotKey.IsRegistered) { UnregisterHotKey(mode); } if (hotKey.Modifiers == WindowNative.KeyModifiers.None && hotKey.Key == Keys.None) { return; } if (WindowNative.RegisterHotKey(Handle, (int)mode, hotKey.Modifiers, hotKey.Key)) { hotKey.IsRegistered = true; } }