GetAnsiKeyState(), I heard will catch keystrokes. How can I do this? Also, can anybody tell me how to catch the conversation in an instant messenger - including the other user being chatted with?
Printable View
GetAnsiKeyState(), I heard will catch keystrokes. How can I do this? Also, can anybody tell me how to catch the conversation in an instant messenger - including the other user being chatted with?
It is called the GetAsyncKeyState API function and is used like this:
VB Code:
Private Declare Function GetAsyncKeyState Lib "user32" _ (ByVal vKey As Long) As Integer Private Sub Timer1_Timer() Dim iKey As Integer For iKey = 3 To 255 If GetAsyncKeyState(iKey) Then RichTextBox1.Text = RichTextBox1.Text & Chr(iKey) Next iKey End Sub
Ok, thanks! So using this, how could I detect certain words typed? And anybody know an answer to the catching AIM converstaions and loggin them question?
Like Matthew Gates said, you can use the GetAsyncKeyState function to read keyboard input into a text box...then you could use the Instr function to search for a certain word. As for catching AIM conversations...I'm not exactly sure how to do this (code-wise), but you *could* use the same timer to check to see if an AIM window is up, and if it is, catch the keystrokes entered. You'd only get a one-sided conversation that way, though. To get it all, you'd need to install a packet sniffer on the computer you want to...log ;)
You see, what I ideally want to do is catch a bad word and then star it before that person could press enter (I could catch it quickly witha timer) but I don;t know how to change that. I could SendKey()? I don't know how that API call works tho.
Sendkeys isn't an API call, it's part of the VB set. If it was possible to subclass the AIM window or get its handle, you could use the SendMessage API call. I don't know how to go about it, though