GetAsyncKeyState API Definition
I was wondering about a way to get the keyboard strokes & read them. This windows api can be used from all sorts of keylogger hacking tricks to useful shortcut keys in an OS that you would like to define. here is a small code snippet with explanation:
This snippet shows the user how to get the key pressed. That is if the user presses control key that key is identified. Using this we can develop applications with greater flexibility. For example we can make an application to close if a key is pressed and so on.
This code is basically a smaller one with greater potential. It just contains three lines of code.
Public Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Long) As Integer
On Error Resume Next
'To check wheteher Control key is pressed
If GetAsyncKeyState(17) Then
msgbox "Control key pressed"
End If
Leave a Reply
You must be logged in to post a comment.