Jump to content

Keyboard Buffer


Recommended Posts

  • 2 months later...

I looked into this many years ago. The basic keyboard flow is:

Keyboard --> Keyboard Device Driver --> System Message Queue --> Thread Message Queue --> Thread Message Loop --> Window Procedure

If you want to manipulate the keyboard buffer itself, you'd have to work at the keyboard device driver level or lower. Uggh...

I "empty" the keyboard in our application software. I launch Word to let users edit a document and I want them to close Word before letting them work in our application again. While I'm waiting for them to close Word, I sit in a loop looking at the message queue. I discard any keyboard or mouse messages sent to my application. That way, they can't click or type in our application until they close Word first.

HTH

Auto3Lib: A library of over 1200 functions for AutoIt
Link to comment
Share on other sites

hmm, what is the purpose of this?

@PaulIA: Would not

GuiSetState(@SW_HIDE)
RunWait("msword.exe") ;Or somthing similar
GuiSetState(@SW_SHOW)
Do this?

If I recall right you can do a api call to clear the keybord buffer. Check out the api calls used by _IsPressed in Misc.au3.

Link to comment
Share on other sites

GuiSetState(@SW_HIDE)
RunWait("msword.exe") ;Or somthing similar
GuiSetState(@SW_SHOW)

I can't hide the screen. The users need to refer back to information on the screen when typing information in Word.

I checked out _IsPressed in Misc.au3, but I'm missing what you are referring to. The only API call that _IsPressed makes is to GetAsyncKeyState to determine if a key is pressed. Am I missing something?

Auto3Lib: A library of over 1200 functions for AutoIt
Link to comment
Share on other sites

If you poke around MSDN I think you will find how to clear the buffer using that, or an assosiated, API call. I might recall wrong thought, it's just to many API calls for my brain to handel :lmao:

Link to comment
Share on other sites

I really don't think there is any API call to directly access the keyboard hardware. The keyboard device driver does this for you. I think the only way to empty the keyboard is to install a hook using SetWindowsHookEx (if you need to empty keys at a global level) or PeekMessage/Dispatch if you only need to do this within your application.

If anybody does know of an API call to do this, I would be interested in hearing about it too.

Auto3Lib: A library of over 1200 functions for AutoIt
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...