Thursday, October 21, 2010

Capture keyboard press in a background running VB form?

I want to capture keyboard press in a background running VB form (not selected). Actually nothing but hidden keyboard scanner. How is it possible? Bit urgent.Capture keyboard press in a background running VB form?
You can use an API function called 'GetAsyncKeyState'.



its declaration:

Declare Function GetAsyncKeyState Lib ';user32'; Alias ';GetAsyncKeyState'; (ByVal vKey As Long) As Integer



vKey means the virtual key in VB, some times it's a ASCII code;

If the first bit of the returned integer is one('1'), the key is pressed once,

If the 16th bit of the returned integer is one('1'), the key is being pressed down(eg., VK_LSHIFT, VK_LBUTTON, etc),



MSDN said this function is useful only when the form is focused, but, in fact, according to my experience, it's global.



you can search more info about this functionCapture keyboard press in a background running VB form?
There are many programmers that has the similar function in the internet.

For example, AllSpyMonitor Keylogger

No comments:

Post a Comment