// Install the hook public void Install() { InternalHook = Win32Api.SetWindowsHookEx(InternalHookType, CallBackFunction, IntPtr.Zero, Win32Api.GetCurrentThreadId()); }
private static bool IsPressed(Keys key) { const int keyPressed = 0x8000; return(Convert.ToBoolean(Win32Api.GetKeyState((int)key) & keyPressed)); }