Esempio n. 1
0
 protected override void WndProc(ref Message m)
 {
     if (m.Msg == 786)
     {
         Keys         hKey             = (Keys)((int)m.LParam >> 16 & (int)ushort.MaxValue);
         KeysModifier hModifier        = (KeysModifier)((int)m.LParam & (int)ushort.MaxValue);
         uint         foregroundWindow = PlayerKey.GetForegroundWindow();
         Dialog       dialog           = Game.DialogList == null ? (Dialog)null : Game.DialogList.GetDialog("chat_input_dialog", false);
         for (int index = 0; index < PlayerKey._hHotKey.Count; ++index)
         {
             if (PlayerKey._hHotKey[index] != null && (Keys)PlayerKey._hHotKey[index][1] == hKey && (KeysModifier)PlayerKey._hHotKey[index][2] == hModifier)
             {
                 if ((int)foregroundWindow == (int)Game.Process.ProcessWindowHandle && (dialog == null || !dialog.IsVisible()))
                 {
                     if ((bool)PlayerKey._hHotKey[index][3])
                     {
                         ((AionEventKeyHandler)PlayerKey._hHotKey[index][0])(hKey, hModifier);
                         break;
                     }
                     ((AionEventHandler)PlayerKey._hHotKey[index][0])();
                     break;
                 }
                 PlayerKey.UnregisterHotKey(this.Handle, index + 1);
                 PlayerKey.keybd_event((byte)hKey, (byte)69, 1U, UIntPtr.Zero);
                 PlayerKey.keybd_event((byte)hKey, (byte)69, 3U, UIntPtr.Zero);
                 PlayerKey.RegisterHotKey(this.Handle, index + 1, (uint)hModifier, (uint)hKey);
                 break;
             }
         }
     }
     else
     {
         base.WndProc(ref m);
     }
 }
Esempio n. 2
0
 public void RegisterThread()
 {
     if (PlayerInput._hPlayerKey != null)
     {
         return;
     }
     PlayerInput._hPlayerKey = new PlayerKey();
 }
Esempio n. 3
0
 public void Unregister(Keys hKey, KeysModifier hModifier = KeysModifier.None)
 {
     for (int index = 0; index < PlayerKey._hHotKey.Count; ++index)
     {
         if (PlayerKey._hHotKey[index] != null && (Keys)PlayerKey._hHotKey[index][1] == hKey && (KeysModifier)PlayerKey._hHotKey[index][2] == hModifier)
         {
             PlayerKey.UnregisterHotKey(this.Handle, index + 1);
             PlayerKey._hHotKey[index] = (ArrayList)null;
             break;
         }
     }
 }
Esempio n. 4
0
        protected bool _Register(ArrayList hItem)
        {
            for (int index = 0; index < PlayerKey._hHotKey.Count; ++index)
            {
                if (PlayerKey._hHotKey[index] != null && (Keys)PlayerKey._hHotKey[index][1] == (Keys)hItem[1] && (KeysModifier)PlayerKey._hHotKey[index][2] == (KeysModifier)hItem[2])
                {
                    return(false);
                }
            }
            Keys         keys         = (Keys)hItem[1];
            KeysModifier keysModifier = (KeysModifier)hItem[2];

            if (!PlayerKey.RegisterHotKey(this.Handle, PlayerKey._iHotKey + 1, (uint)keysModifier, (uint)keys))
            {
                Marshal.GetLastWin32Error();
                return(false);
            }
            PlayerKey._hHotKey.Add(PlayerKey._iHotKey, hItem);
            ++PlayerKey._iHotKey;
            return(true);
        }