[2008] Check if all keys on the keyboard are released?
Hi guys,
I'm using an API in order to "catch" keys when my application is minimized, but I have a problem...
I want to check if all of the keyboard keys are released, I haven't found an option to do it,
I'm looking for something like:
Code:
If Keyboard.AllKeysUp then
Blablalbbal
End if
I know it sounds too stupid but I want to create an option to "catch" hotkeys, so I need a function
that will check if all keys are up, as I might said in previous threads I use one of the API's that
one of the users in this forum gave me (Thank you very much...!) this is the API:
http://ih4x.wordpress.com/2008/05/05...d-hook-global/
and no, I'm NOT making a keylogger... so please don't think it's for tracking someone stuff and using it for any purpose...
I used another way to check the keys, I made a counter, I declared a varibale as integer that for each key down it will increase by one count +=1 and for each key up count -=1 so if Count=0 all keys are up... but this is not working right for some reason, so I have to use a function similar to what I have wrriten up...
Thanks!
Re: [2008] Check if all keys on the keyboard are released?
Here is an idea. Handle the keyboard's keydown and keyup events. Use a class scoped list(Of Keys) and in the keydown event, add e.KeyCode to the list if the list doesn't contain it; In the keyup event, remove e.KeyCode from the list and get the count from the list. If the list has 0 item, all keys have been released.
Re: [2008] Check if all keys on the keyboard are released?
@stanav - does that work when the form is minimized?
Re: [2008] Check if all keys on the keyboard are released?
Quote:
Originally Posted by dbasnett
@stanav - does that work when the form is minimized?
That is just an idea... I'm not sure if it works when the form is minimized or not. However, since he can hook the keyboard globally, logically the idea should work as long as he can receive the keydown and keyup events.
Re: [2008] Check if all keys on the keyboard are released?
I think I understand what are trying to say, but after thinking a bit more, I don't think
I will need it I thought about using an API that sends keydown and keyup (I need to catch hotkeys
and send them in sendkeys.send so if I will use other API with the option to send Keyup and Keydown events I won't need this "Counter" )
So I have another question, how is the API called (I need an API that sends Keydown and Keyup events) the sendkeys.send is not good for me because I need to send the Keyup and Keydown events... (so I won't need the counter, and it will be better for me...)? and where can I find information about it and how to use it?