@PB: If your code checks to see if the keyboard buffer was cleared why do you have it display a message that says "I only want to see this when pressed together?" That's seems to contradict. When I run the code with the specific line commented I don't even have to click the mouse button and it displays the message by simply pushing Shift by itself.PB wrote:> works here no matter how i comment*phew*
So, if the For/Next is removed/commented, you can run the app, and click
the left mouse button once, release it, then press the Shift key, and you're
saying NO MessageRequester appears? Because it does on three PCs that
I've tried it with. Try it in Safe Mode, because you may be running an app
that is clearing those keys states. And what OS are you running?
@MrMat: I want to know how to clear the keyboard buffer, so doing a check
with $8000 is of no concern to me in this discussion. It may make it work,
but that's not the question I asked.
One other thing to note, GetAsyncKeyState_() does not use a keyboard buffer. It keeps track of the actual state of the key and whether it was pushed since the last call of GetAsyncKeyState (for that key). By the way the specific code can be fixed by the following:
Code: Select all
Repeat
Sleep_(1)
GetAsyncKeyState_(#VK_LBUTTON) ;use this line to fix your problem
;For K=0 To 255 : GetAsyncKeyState_(K) : Next
If GetAsyncKeyState_(#VK_SHIFT)<>0 And GetAsyncKeyState_(#VK_LBUTTON)<>0
MessageRequester("test","I only want to see this when pressed together")
End
EndIf
ForEver
I remember you were trying to find the fastest way to clear the "status" of each key, since we're not using a buffer. It would seem the loop you proposed originally would do that.