Ejemplo n.º 1
0
        public void SetKeybind(string key)
        {
            var keybindOld = Keybind;

            try
            {
                Keybind = key.ToCharArray()[0].ToString().ToUpper();

                // http://www.pinvoke.net/default.aspx/user32/MapVirtualKey.html
                _VirtualKeyCode = (SendInputWrapper.ScanCodeShort)SendInputWrapper.MapVirtualKey((uint)(Keys)Enum.Parse(typeof(Keys), _Keybind, true), 0x00);
                log.Info("Changed keybind to " + Keybind);
            }
            catch (Exception e)
            {
                log.Debug("Unable to set keybind: " + e.Message);
                Keybind = keybindOld;
            }
        }
Ejemplo n.º 2
0
 private SendInputWrapper.ScanCodeShort GetScanCode(Keys key)
 {
     return((SendInputWrapper.ScanCodeShort)SendInputWrapper.MapVirtualKey((uint)key, 0x00));
 }