Example #1
0
 private void OnHookInvoked(HookEventArgs e)
 {
   if (HookInvoked != null)
   {
     HookInvoked(this, e);
   }
 }
Example #2
0
 private void OnHookInvoked(HookEventArgs e)
 {
     if (HookInvoked != null)
     {
         HookInvoked(this, e);
     }
 }
Example #3
0
            public KeyboardHookStruct(HookEventArgs e)
            {
                KeyboardHookStruct khs = (KeyboardHookStruct)Marshal.PtrToStructure(e.LParam, typeof(KeyboardHookStruct));

                virtualKey  = khs.virtualKey;
                scanCode    = khs.scanCode;
                flags       = khs.flags;
                time        = khs.time;
                dwExtraInfo = khs.dwExtraInfo;
            }
Example #4
0
      public KeyboardHookStruct(HookEventArgs e)
      {
        KeyboardHookStruct khs = (KeyboardHookStruct)Marshal.PtrToStructure(e.LParam, typeof (KeyboardHookStruct));

        virtualKey = khs.virtualKey;
        scanCode = khs.scanCode;
        flags = khs.flags;
        time = khs.time;
        dwExtraInfo = khs.dwExtraInfo;
      }
Example #5
0
 private void OnHookInvoked(object sender, HookEventArgs e)
 {
     if (e.WParam == 256 && KeyDown != null)
     {
         KeyboardHookStruct khs = new KeyboardHookStruct(e);
         KeyDown(sender, new KeyEventArgs((Keys)khs.virtualKey | Control.ModifierKeys));
     }
     else if (e.WParam == 257 && KeyUp != null)
     {
         KeyboardHookStruct khs = new KeyboardHookStruct(e);
         KeyUp(sender, new KeyEventArgs((Keys)khs.virtualKey | Control.ModifierKeys));
     }
 }
Example #6
0
 private void OnHookInvoked(object sender, HookEventArgs e)
 {
   if (e.WParam == 256 && KeyDown != null)
   {
     KeyboardHookStruct khs = new KeyboardHookStruct(e);
     KeyDown(sender, new KeyEventArgs((Keys)khs.virtualKey | Control.ModifierKeys));
   }
   else if (e.WParam == 257 && KeyUp != null)
   {
     KeyboardHookStruct khs = new KeyboardHookStruct(e);
     KeyUp(sender, new KeyEventArgs((Keys)khs.virtualKey | Control.ModifierKeys));
   }
 }
Example #7
0
        private int InternalHookDelegate(int code, int wParam, IntPtr lParam)
        {
            if (code == 0)
            {
                HookEventArgs e = new HookEventArgs(code, wParam, lParam);

                OnHookInvoked(e);

                if (e.Handled)
                {
                    return(1);
                }
            }

            return(Util.Win32API.CallNextHookEx(_hookHandle, code, wParam, lParam));
        }
Example #8
0
    private int InternalHookDelegate(int code, int wParam, IntPtr lParam)
    {
      if (code == 0)
      {
        HookEventArgs e = new HookEventArgs(code, wParam, lParam);

        OnHookInvoked(e);

        if (e.Handled)
        {
          return 1;
        }
      }

      return Util.Win32API.CallNextHookEx(_hookHandle, code, wParam, lParam);
    }
Example #9
0
 void OnHookInvoked(object sender, HookEventArgs e)
 {
     if ((e.WParam == WM_KEYDOWN || e.WParam == WM_SYSKEYDOWN) && KeyDown != null)
     {
         KeyboardHookStruct khs = new KeyboardHookStruct(e);
         KeyEventArgsEx kea = new KeyEventArgsEx(khs.virtualKey, Control.ModifierKeys, khs.scanCode);
         KeyDown(sender, kea);
         e.Handled = kea.Handled;
     }
     else if ((e.WParam == WM_KEYUP || e.WParam == WM_SYSKEYUP) && KeyUp != null)
     {
         KeyboardHookStruct khs = new KeyboardHookStruct(e);
         KeyEventArgsEx kea = new KeyEventArgsEx(khs.virtualKey, Control.ModifierKeys, khs.scanCode);
         KeyUp(sender, kea);
         e.Handled = kea.Handled;
     }
 }