protected override bool Callback(CallbackData data) { var SW = System.Diagnostics.Stopwatch.StartNew(); var NewData = data.ToGlobalKeyboardEventSourceCallbackData(); //This call is required to work around a bug in Window's 'Get Keyboard State' API. When the bug occurs, it always returns the same keyboard state. KeyboardState.GetKeyState(KeyCode.None); var e = GetInputEventArgs(NewData.Message, NewData); var Input = e.Data; var Wait = new Wait(e.Timestamp - State.LastInputDate); State.LastInputDate = e.Timestamp; var KeyDown = Input.Status == KeyStatus.Pressed ? new KeyDown(e.Data.Key, e.Data.Extended) : null ; var KeyUp = Input.Status == KeyStatus.Released ? new KeyUp(e.Data.Key, e.Data.Extended) : null ; var TextClick = GetTextClick(NewData.Message, NewData); var KeyEvent = new KeyboardEvent(Wait, KeyDown, TextClick, KeyUp); var ret = InvokeMany(KeyEvent, NewData, e.Timestamp); Console.WriteLine(SW.Elapsed); return ret.Next_Hook_Enabled; }