Exemple #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);
     }
 }
Exemple #2
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;
         }
     }
 }