コード例 #1
0
 private static IntPtr SetHook(InterceptKeys.LowLevelKeyboardProc proc)
 {
     using (Process currentProcess = Process.GetCurrentProcess())
     {
         using (ProcessModule mainModule = currentProcess.MainModule)
             return(InterceptKeys.SetWindowsHookEx(13, proc, InterceptKeys.GetModuleHandle(mainModule.ModuleName), 0U));
     }
 }
コード例 #2
0
 private static IntPtr HookCallback(int nCode, IntPtr wParam, IntPtr lParam)
 {
     if (nCode >= 0 && wParam == (IntPtr)256)
     {
         int num = Marshal.ReadInt32(lParam);
         if (InterceptKeys.KeyPress != null)
         {
             InterceptKeys.KeyPress((object)null, new EventArgs <int>(num));
         }
     }
     return(InterceptKeys.CallNextHookEx(InterceptKeys._hookID, nCode, wParam, lParam));
 }
コード例 #3
0
 public static void Dispose()
 {
     InterceptKeys.UnhookWindowsHookEx(InterceptKeys._hookID);
 }
コード例 #4
0
 public static void Init()
 {
     InterceptKeys._hookID = InterceptKeys.SetHook(InterceptKeys._proc);
 }