Key Capture

BlitzPlus Forums/BlitzPlus Programming/Key Capture

I want to record the user's input, both key board and mouse, while the user is in another program. How can I do this?

Ok, the user32.dll offers "GetKeyboardState(buffer)"
Your supposed to pass it a 256 byte buffer that it fills with the states of all 256 virtualKeys. But no matter what I hit the returned data reads all 0's. I think I may be passing the bank to it in the wrong way. Any help?

bank = CreateBank(256)
 Print "Starting scan..."
Repeat
x = api_GetKeyboardState(bank) 
For I = 0 To 255
v = PeekByte(bank, i)
If  v <> 0 Then Print PeekByte(bank, i)
Next
Forever 


MSDN makes it sound like it takes an array, so you might want to try that.