How do I flush the keyboard buffer in C# using Windows Forms?
I have a barcode scanner which acts like a keyboard. If a really long barcode is scanned and the cancel
I'm not sure you can do this. The keystrokes go into the event queue for the main event loop. Any action you take to cancel these keystrokes will be placed in the queue after the keystrokes.
The event loop will only get to your cancel action after the keystrokes have been processed. You can only cancel the keystrokes based on some event that happens in the middle of the keystroke sequence.