Ejemplo n.º 1
0
        public bool RegisterHotkey(KeyContainer Container)
        {
            //Check if hotkey is already registered, else add
            if (IsHotkeyRegistered(Container))
            {
                return(false);
            }
            Container.HotkeyId = ++keyCounter;
            //New key, register it.
            var retVal = RegisterHotKey(_windowHandle, Container.HotkeyId, Container.GetKeyModifiers(), Container.Key);

            Console.WriteLine($"RegisterHotKey for id {Container.HotkeyId} returned {retVal}");
            if (retVal == 0)
            {
                return(false);
            }
            RegisteredHokeys.Add(Container);
            return(true);
        }