How to clear keyboard buffer
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4

Thread: How to clear keyboard buffer

  1. #1
    Join Date
    May 2005
    Posts
    2

    Angry How to clear keyboard buffer

    Hello there,

    I'm writing an app to help with spelling. You see a picture, the letters appear 1 by one (with a 'sleep' from kernel32 in between) and then the letters disappear. Keystrokes are then used to type in the word yourself.

    The problem is that while the picture and letters are in the process of being shown any keystrokes are stored in the keyboard buffer and are activated as soon as the procedure comes to an end. I've tried deactivating the sub that reads the keystrokes and only activating after everything is done but the keyboard buffer holds onto it until that point anyway.

    The only thing I can think of is to show the pic and letters and then clear the k/b buffer all in 1 sub - any ideas?

    TIA

    HH

  2. #2
    Join Date
    Aug 2000
    Location
    Essex, Uk
    Posts
    1,214

    Re: How to clear keyboard buffer

    why not place some code in the form's keypress event
    If you find my answers helpful, dont forget to rate me

  3. #3
    Join Date
    Jul 2000
    Location
    Milano, Italy
    Posts
    7,726

    Re: How to clear keyboard buffer

    or search for keyboard hook, and you will be able to deviate quite all keystrokes (but ctrl+alt+canc!), from your app.
    ...at present time, using mainly Net 4.0, Vs 2010



    Special thanks to Lothar "the Great" Haensler, Chris Eastwood , dr_Michael, ClearCode, Iouri and
    all the other wonderful people who made and make Codeguru a great place.
    Come back soon, you Gurus.

  4. #4
    Join Date
    May 2005
    Posts
    2

    Smile Re: How to clear keyboard buffer

    Bill - there is code in the KeyPress sub - the problem is the keystroke is actioned at the end of the sequence regardless of when it was pressed. I need to run a sequence of instructions, clear whatever the numpty (I mean user) has pressed during that time so that they keystroke event can be read from then on

    Cimperiali - so possibilities with a keyboard hook, will investigate more - cheers for that

    HH

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Azure Activities Information Page

Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center