Example #1
0
 private void I(object sender, HookEventArgs e)
 {
     MSLLHOOKSTRUCT st = (MSLLHOOKSTRUCT)Marshal.PtrToStructure(e.lParam, typeof(MSLLHOOKSTRUCT));
     OnEventRaised(new MouseEventArgs()
     {
         Message = (MouseMessage)e.wParam,
         Point = st.pt,
         ExtraInfo = st.dwExtraInfo,
         WheelDelta = (MouseMessage)e.wParam == MouseMessage.WM_MOUSEWHEEL ? st.mouseData >> 16 & 0xFF : 0
     });
 }
Example #2
0
 private int HookProcBase(int nCode, IntPtr wParam, IntPtr lParam)
 {
     if (nCode < 0)
         return CallNextHookEx(_hHook, nCode, wParam, lParam);
     HookEventArgs e = new HookEventArgs()
     {
         code = nCode,
         wParam = wParam,
         lParam = lParam
     };
     OnInvoked(e);
     return CallNextHookEx(_hHook, nCode, wParam, lParam);
 }
Example #3
0
 private void I(object sender, HookEventArgs e)
 {
     KBDLLHOOKSTRUCT st = (KBDLLHOOKSTRUCT)Marshal.PtrToStructure(e.lParam, typeof(KBDLLHOOKSTRUCT));
     OnEventRaised(new KeyboardHookEventArgs()
     {
         Message = (KeyboardMessage)e.wParam,
         VkCode = st.vkCode,
         ScanCode = st.scanCode,
         AltDown = (st.flags & LLKHF_ALTDOWN) > 0,
         ExtendedKey = (st.flags & LLKHF_EXTENDED) > 0,
         Injected = (st.flags & LLKHF_INJECTED) > 0,
         Up = (st.flags & LLKHF_UP) > 0
     });
 }
Example #4
0
 private void OnInvoked(HookEventArgs e)
 {
     if (Invoked != null)
         Invoked(this, e);
 }