locked
Visual Basic 2008 Mouse & Keyboard Recorder - VB.NET recording keystrokes RRS feed

  • Question

  • I have seen that there are many "Mouse & Keyboard Macros/Recorders" out there & I was wondering how they are being created in visual basic. I have looked within the Microsoft forums, but havent really seen any specific coding that works for the kind of recorder that I'm trying to create.

    To be more specific with what I'm trying to do:

    1- I will have a form that has the Record, Stop & Playback buttons.

    2- It will record any of the clicks/movement of the mouse & any keys that are being pressed.

    3- Has the ability to interact with any windows form app or any web form app.

    Could someone just give a quickstart guide on this or some great code examples? I'm not asking for you to code a whole program for me, but just to give some direction.

    I would greatly appreciate the help.

    Thanks to whomever can help.
    • Edited by Martin Xie - MSFT Tuesday, October 27, 2009 6:33 AM Refine the thread title.
    Tuesday, October 20, 2009 2:37 AM

Answers

  • 2- It will record any of the clicks/movement of the mouse & any keys that are being pressed.

    Look VBNETMAN !
    You Must Make it by Your self We are alread provide you many thing
    You can Merge these all by Your self

    here is Example of Auto Mouse Clicker:

    You need Two Timer
    1st name is :hotkeys
    Make it Enabled=true
    and set interval =1000

    2nd name is :Clicks
    Make it Enabled=False
    And set interval=1

    Public Class Form1
        Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vkey As Long) As Integer
        Private Declare Sub mouse_event Lib "user32" (ByVal dwflag As Long, ByVal dx As Long, ByVal dy As Long, ByVal cbuttons As Long, ByVal dwextrainfo As Long)
        Private Const mouseclickup = 4
        Private Const mouseclicdownl = 2
        Private Sub Hotkeys_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Hotkeys.Tick
            Dim hotkey1 As Boolean
            hotkey1 = GetAsyncKeyState(Keys.F5)
            If hotkey1 = True Then
                Clicks.Start()
            End If
            Dim hotkey2 As Boolean
            hotkey2 = GetAsyncKeyState(Keys.F6)
            If hotkey2 = True Then
                Clicks.Stop()
            End If
        End Sub
    
        Private Sub Click_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Clicks.Tick
            Clicks.Interval = TextBox1.text
            mouse_event(mouseclicdownl, 0, 0, 0, 0)
            mouse_event(mouseclickup, 0, 0, 0, 0)
        End Sub
    End Class
    

    My Givin code is Work with Key.F5 For enabled Clicking and Key.F6 for Disabled Clicking

    Thursday, October 22, 2009 12:44 PM
  • Hay Genious

    Make A sence I know That is Not your Answer But According to My Code:

    You have A Trick to Get Location
    You Have A Trick To Clicking

    You can Control Clicking By Timer  
    When Mouse Clicked Once Then it shouldbe Off After One Click

    But This Trick is Only Work on You Application Not For Desktop , or Another Application



    Best Of Luck

    Monday, October 26, 2009 3:44 AM

All replies

  • Stop posting annoying title. We dont need dictionary to understand your question.

    For your keylogger program, try this thread
    http://social.msdn.microsoft.com/Forums/en-US/vbgeneral/thread/b134eefa-5305-4ef1-90c6-ecc6570b4ea4

    kaymaf

     

     


    If that what you want, take it. If not, ignored it and no complain
    • Proposed as answer by MaDFroG20091013 Wednesday, October 21, 2009 2:51 AM
    • Marked as answer by YiChun Chen Wednesday, October 21, 2009 11:38 AM
    • Unmarked as answer by VBNETMAN Wednesday, October 21, 2009 8:26 PM
    • Unproposed as answer by VBNETMAN Wednesday, October 21, 2009 10:42 PM
    Tuesday, October 20, 2009 4:36 AM
  • Stop posting annoying title. We dont need dictionary to understand your question.

    For your keylogger program, try this thread
    http://social.msdn.microsoft.com/Forums/en-US/vbgeneral/thread/b134eefa-5305-4ef1-90c6-ecc6570b4ea4

    kaymaf

     

     


    If that what you want, take it. If not, ignored it and no complain


    Wow!!! No need to be rude Kaymaf!!! Don't accuse me of trying to make a keylogger for malicious purposes. That's a very ignorant type of behavior to display. I have tedious tasks that at times I may need a macro for. 

    I always do the titles this way so that people who need help in this area, can easily find the answers in forums based on any of my titles keywords. This is very effective for those who need to find a thread on this topic.

    But thanks for the link. I will try it out.

    Wednesday, October 21, 2009 8:10 PM
  • Stop posting annoying title. We dont need dictionary to understand your question.

    For your keylogger program, try this thread
    http://social.msdn.microsoft.com/Forums/en-US/vbgeneral/thread/b134eefa-5305-4ef1-90c6-ecc6570b4ea4

    kaymaf

     

     


    If that what you want, take it. If not, ignored it and no complain


    Ok Kaymaf,

    Based on the link that you directed me to, I figured out how to record the mouse movement, but I didn't see any instruction on how to record the mouse clicks. Maybe I missed that part, but could you please show how to implement the mouse clicks with the following code that I came up with?:


    Public Class Form1
        Private Declare Sub SetCursorPos Lib "User32" (ByVal X As Integer, ByVal Y As Integer)
    
        Dim posx(600) As Integer
        Dim posy(600) As Integer
    
        Dim time As Integer = 0
        Dim run As Integer = 0
        Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
            Button1.Enabled = False
            Button2.Enabled = True
            Timer1.Start()
    
        End Sub
    
        Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    
        End Sub
    
        Private Sub Button1_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
            Button1.Enabled = False
            Button2.Enabled = True
            Timer1.Start()
        End Sub
    
        Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
            Button2.Enabled = False
            Button3.Enabled = True
            Timer1.Stop()
    
        End Sub
    
        Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
            Button1.Enabled = True
            Timer2.Start()
    
        End Sub
    
        Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
            time = time + 1
            posx(time) = Cursor.Position.X
            posy(time) = Cursor.Position.Y
    
            If time = 600 Then
                Button2.Enabled = False
                Button3.Enabled = True
                Timer1.Stop()
            End If
    
        End Sub
    
        Private Sub Timer2_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer2.Tick
            run = run + 1
            SetCursorPos(posx(run), posy(run))
    
            If run = time Then
                Timer2.Stop()
            End If
    
        End Sub
    
        Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
            Label1.Text = Label1.Text + 1
        End Sub
    
        Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
            Label1.Text = "0"
        End Sub
    End Class


    Wednesday, October 21, 2009 8:36 PM

  • 1- I will have a form that has the Record, Stop & Playback buttons.



    Hi VBNETMEN !
    My Givin Code is Record you Mouse Movement and After Record Its Play With Picturebox
    this is CrazyPennie Code:
    Record Loacation by Mouse And Play Picturebox

    Public Class Form1
        Private Q As New Queue(Of Point)
    
        Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
            Dim Screenpoint As Point = MousePosition
            Dim a As Size = Me.Size - Me.ClientSize
            Dim pt As Point = New Point(a.Width / 2, a.Height - a.Width / 2)
            Dim WindowPoint As Point = Screenpoint - Me.Location - pt
            Q.Enqueue(WindowPoint)
        End Sub
    
        'record button
        Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
            If Timer1.Enabled Then
                Timer1.Stop()
            Else
                Timer1.Interval = 100
                Timer1.Start()
            End If
        End Sub
    
        'Playback button
        Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
            If Timer2.Enabled Then
                Timer2.Stop()
            Else
                Timer2.Interval = 100
                Timer2.Start()
            End If
        End Sub
    
        Private Sub Timer2_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer2.Tick
            Dim Pt As Point = Q.Dequeue
            PictureBox1.Location = Pt
            Q.Enqueue(Pt)
        End Sub
    End Class
    

    Thanx CrazyPennie
    • Edited by Shariq Ayaz Wednesday, October 21, 2009 10:32 PM
    Wednesday, October 21, 2009 10:12 PM
  • if you want to record mouse movement in Form
    and make list of movement
    That is My Friend Code:
    you need two Listboxes
    one for x
    one for y 
    Private Sub Form1_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseMove
            ListBox1.Items.Add(e.Location.X.ToString)
            ListBox2.Items.Add(e.Location.Y.ToString)    
    End Sub
    Thanks you My Friend
    Wednesday, October 21, 2009 10:18 PM
  • if you want to record mouse movement in Form
    and make list of movement
    That is My Friend Code:
    you need two Listboxes
    one for x
    one for y 
    Private Sub Form1_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseMove
            ListBox1.Items.Add(e.Location.X.ToString)
            ListBox2.Items.Add(e.Location.Y.ToString) 
    End Sub
    
    
    Thanks you My Friend



    if you want to use one Listbox to save X,Y

    This Is Paramu Code:
    Using one listbox
    Private Sub Form1_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) HandlesMe.MouseMove
            ListBox1.Items.Add(e.Location.ToString)
    End Sub
    Private Sub ListBox1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles ListBox1.Click
            PictureBox1.BackgroundImage = MyImg
            PictureBox1.BackgroundImageLayout =ImageLayout.Stretch
            Dim a2(2) As String
            Dim a1 As String = ListBox1.SelectedItems(0).ToString
            a2 = a1.Split(",")
            Dim LeftLoc As Integer = CInt(a2(0).Substring(3))
            Dim TopLoc As Integer = Val(a2(1).Substring(2))
            PictureBox1.Location = New Point(LeftLoc, TopLoc)
            PictureBox1.Left = LeftLoc
            PictureBox1.Top = TopLoc
    End Sub
    
    Thanx you Paramu
    • Proposed as answer by Shariq Ayaz Wednesday, October 21, 2009 10:37 PM
    • Unproposed as answer by VBNETMAN Friday, October 23, 2009 12:44 AM
    Wednesday, October 21, 2009 10:23 PM

  • 1- I will have a form that has the Record, Stop & Playback buttons.



    Hi VBNETMEN !
    My Givin Code is Record you Mouse Movement and After Record Its Play With Picturebox
    this is CrazyPennie Code:
    Record Loacation by Mouse And Play Picturebox

    Public Class Form1
    
        Private Q As New Queue(Of Point)
    
    
    
        Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
    
            Dim Screenpoint As Point = MousePosition
    
            Dim a As Size = Me.Size - Me.ClientSize
    
            Dim pt As Point = New Point(a.Width / 2, a.Height - a.Width / 2)
    
            Dim WindowPoint As Point = Screenpoint - Me.Location - pt
    
            Q.Enqueue(WindowPoint)
    
        End Sub
    
    
    
        'record button
    
        Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    
            If Timer1.Enabled Then
    
                Timer1.Stop()
    
            Else
    
                Timer1.Interval = 100
    
                Timer1.Start()
    
            End If
    
        End Sub
    
    
    
        'Playback button
    
        Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
    
            If Timer2.Enabled Then
    
                Timer2.Stop()
    
            Else
    
                Timer2.Interval = 100
    
                Timer2.Start()
    
            End If
    
        End Sub
    
    
    
        Private Sub Timer2_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer2.Tick
    
            Dim Pt As Point = Q.Dequeue
    
            PictureBox1.Location = Pt
    
            Q.Enqueue(Pt)
    
        End Sub
    
    End Class
    
    
    
    

    Thanx CrazyPennie


    Hi ShariqDon,

    Thanks for your reply. Let me try this and I will report back to you in a few mins to let you know if it works or if there is any errors.

    Thanks
    Wednesday, October 21, 2009 10:31 PM
  • if you want to record mouse movement in Form
    and make list of movement
    That is My Friend Code:
    you need two Listboxes
    one for x
    one for y 
    Private Sub Form1_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseMove
    
            ListBox1.Items.Add(e.Location.X.ToString)
    
            ListBox2.Items.Add(e.Location.Y.ToString) 
    
    End Sub
    
    
    
    
    Thanks you My Friend



    if you want to use one Listbox to save X,Y

    This Is Paramu Code:
    Using one listbox
    Private Sub Form1_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) HandlesMe.MouseMove
    
            ListBox1.Items.Add(e.Location.ToString)
    
    End Sub
    
    Private Sub ListBox1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles ListBox1.Click
    
            PictureBox1.BackgroundImage = MyImg
    
            PictureBox1.BackgroundImageLayout =ImageLayout.Stretch
    
            Dim a2(2) As String
    
            Dim a1 As String = ListBox1.SelectedItems(0).ToString
    
            a2 = a1.Split(",")
    
            Dim LeftLoc As Integer = CInt(a2(0).Substring(3))
    
            Dim TopLoc As Integer = Val(a2(1).Substring(2))
    
            PictureBox1.Location = New Point(LeftLoc, TopLoc)
    
            PictureBox1.Left = LeftLoc
    
            PictureBox1.Top = TopLoc
    
    End Sub
    
    
    
    
    Thanx you Paramu




    Ok,

    I have looked over the above code that you gave and realized that there is no code to "RECORD THE MOUSE CLICKS AND PLAY THEM BACK". I have the code to record the mouse movement, but now I only need to find the code that will record it's clicks of both the right and left clicks.


    Can anyone help out with "RECORDING THE MOUSE CLICKS & A PLAYBACK BUTTON"? 

    Thanks :)
    Wednesday, October 21, 2009 10:36 PM
  • 2- It will record any of the clicks/movement of the mouse & any keys that are being pressed.

    Look VBNETMAN !
    You Must Make it by Your self We are alread provide you many thing
    You can Merge these all by Your self

    here is Example of Auto Mouse Clicker:

    You need Two Timer
    1st name is :hotkeys
    Make it Enabled=true
    and set interval =1000

    2nd name is :Clicks
    Make it Enabled=False
    And set interval=1

    Public Class Form1
        Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vkey As Long) As Integer
        Private Declare Sub mouse_event Lib "user32" (ByVal dwflag As Long, ByVal dx As Long, ByVal dy As Long, ByVal cbuttons As Long, ByVal dwextrainfo As Long)
        Private Const mouseclickup = 4
        Private Const mouseclicdownl = 2
        Private Sub Hotkeys_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Hotkeys.Tick
            Dim hotkey1 As Boolean
            hotkey1 = GetAsyncKeyState(Keys.F5)
            If hotkey1 = True Then
                Clicks.Start()
            End If
            Dim hotkey2 As Boolean
            hotkey2 = GetAsyncKeyState(Keys.F6)
            If hotkey2 = True Then
                Clicks.Stop()
            End If
        End Sub
    
        Private Sub Click_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Clicks.Tick
            Clicks.Interval = TextBox1.text
            mouse_event(mouseclicdownl, 0, 0, 0, 0)
            mouse_event(mouseclickup, 0, 0, 0, 0)
        End Sub
    End Class
    

    My Givin code is Work with Key.F5 For enabled Clicking and Key.F6 for Disabled Clicking

    Thursday, October 22, 2009 12:44 PM
  • 2- It will record any of the clicks/movement of the mouse & any keys that are being pressed.

    Look VBNETMAN !
    You Must Make it by Your self We are alread provide you many thing
    You can Merge these all by Your self

    here is Example of Auto Mouse Clicker:

    You need Two Timer
    1st name is :hotkeys
    Make it Enabled=true
    and set interval =1000

    2nd name is :Clicks
    Make it Enabled=False
    And set interval=1

    <pre lang=x-vbnet>Public Class Form1
    
        Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vkey As Long) As Integer
    
        Private Declare Sub mouse_event Lib "user32" (ByVal dwflag As Long, ByVal dx As Long, ByVal dy As Long, ByVal cbuttons As Long, ByVal dwextrainfo As Long)
    
        Private Const mouseclickup = 4
    
        Private Const mouseclicdownl = 2
    
        Private Sub Hotkeys_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Hotkeys.Tick
    
            Dim hotkey1 As Boolean
    
            hotkey1 = GetAsyncKeyState(Keys.F5)
    
            If hotkey1 = True Then
    
                Clicks.Start()
    
            End If
    
            Dim hotkey2 As Boolean
    
            hotkey2 = GetAsyncKeyState(Keys.F6)
    
            If hotkey2 = True Then
    
                Clicks.Stop()
    
            End If
    
        End Sub
    
    
    
        Private Sub Click_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Clicks.Tick
    
            Clicks.Interval = TextBox1.text
    
            mouse_event(mouseclicdownl, 0, 0, 0, 0)
    
            mouse_event(mouseclickup, 0, 0, 0, 0)
    
        End Sub
    
    End Class
    
    

    My Givin code is Work with Key.F5 For enabled Clicking and Key.F6 for Disabled Clicking



    LOOK SHARIQMORON !!!!

    YOU DON'T NEED TO BE RUDE WITH ME!!! DID I GET RUDE WITH YOU???

    FIRST OF ALL, I DIDN'T ASK YOU HOW TO MAKE THE MOUSE CLICK A THOUSAND TIMES A SECOND. WHAT I ASKED IS COMPLETELY DIFFERENT! I ALREADY KNOW HOW TO MAKE THE MOUSE CLICK A MILLION TIMES WITH YOUR METHOD. YOU DIDN'T UNDERSTAND MY QUESTION!!! I WANT TO RECORD WHAT THE MOUSE DOES AND IT'S CLICKS LIKE A MACRO!!! HAVE YOU EVER HEARD OF THIS??? A MACRO??? IT'S LEGAL!!!

    I'M NOT GOING TO REPEAT MYSELF BECAUSE I ALREADY MADE IT CLEAR WITH WHAT IT IS THAT I'M TRYING TO DO. IT'S YOUR PROBLEM IF YOU HAVE A LEARNING DISABILITY OR CAN'T UNDERSTAND ENGLISH.

    DON'T SHOUT AT ME FOR YOUR OWN PROBLEM!!!

    IF YOU GUYS DON'T WANT TO HELP OR KNOW HOW TO HELP ME, THAT'S FINE, BUT DON'T GET RUDE ABOUT IT. IN FACT I DON'T THINK THAT ANYONE SHOULD REPLY TO A THREAD IF THEY DON'T KNOW THE ANSWER TO IT. THERE'S NO POINT SINCE IT ISN'T GOING TO HELP.

    IF SOMEONE ASK HOW TO DO SOMETHING, THEN DON'T DIRECT THEM IN ANOTHER DIRECTION SINCE THAT ISN'T WHAT THEY ARE ASKING FOR. IT'S OKAY TO TRY HELPING, BUT BEING RUDE ISN'T NECESSARY. JUST DON'T REPLY AT ALL IF YOU'RE GOING TO BE A JERK.


    THIS IS JUST MY RETALIATION INPUT!
    • Edited by Martin Xie - MSFT Tuesday, October 27, 2009 7:02 AM Hi VBNETMAN, nice to see you.Please cool down. Here are many volunteers such as ShariqDON and kaymaf who often kindly help others in their spare time.Hope you All understand each other and get friendly.
    Monday, October 26, 2009 2:00 AM
  • Hay Genious

    Make A sence I know That is Not your Answer But According to My Code:

    You have A Trick to Get Location
    You Have A Trick To Clicking

    You can Control Clicking By Timer  
    When Mouse Clicked Once Then it shouldbe Off After One Click

    But This Trick is Only Work on You Application Not For Desktop , or Another Application



    Best Of Luck

    Monday, October 26, 2009 3:44 AM
  • Hi VBNETMAN,

    Nice to see you. Please cool down and keep with nice mood :)
    ShariqDON has given the helpful instruction with code samples, Kindly please adapt it to your specific needs. I believe you can achieve it by yourself. Teaching fishing is more beneficial than giving directly fish.

    Everyday, here are many volunteers such as ShariqDON and kaymaf who often kindly help others in their spare time. Sometimes, they have no enough time to write full code according to OP's requirement, instead of some related code sample and instruction for enlightening you. Hope you All understand each other and get friendly in MSDN community.

    Let’s discuss questions, share experience and make great progress together at pleasant atmosphere.

    Thank you ShariqDON and kaymaf for your friendly help and support. 


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
    Tuesday, October 27, 2009 7:20 AM
  • Hi VBNETMAN,

    Nice to see you. Please cool down and keep with nice mood :)
    ShariqDON has given the helpful instruction with code samples, Kindly please adapt it to your specific needs. I believe you can achieve it by yourself. Teaching fishing is more beneficial than giving directly fish.

    Everyday, here are many volunteers such as ShariqDON and kaymaf who often kindly help others in their spare time. Sometimes, they have no enough time to write full code according to OP's requirement, instead of some related code sample and instruction for enlightening you. Hope you All understand each other and get friendly in MSDN community.

    Let’s discuss questions, share experience and make great progress together at pleasant atmosphere.

    Thank you ShariqDON and kaymaf for your friendly help and support. 


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.



    Sorry Martin,

    I just felt that he was being rude instead of trying to be helpful.

    Thanks anyway.
    Saturday, November 7, 2009 9:34 PM
  • Hi i am joining in a little late but i think i have the same problem. What i want to do is record the mouse movement and the mouse clicks(left and right).  heres what i have so far.

    Public Class Form1
        Private Sub rec_tmr_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles rec_tmr.Tick
            Try
                ListBox1.Items.Add(Cursor.Position.X)
                ListBox2.Items.Add(Cursor.Position.Y)
            Catch ex As Exception
            End Try
        End Sub

        Private Sub play_tmr_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles play_tmr.Tick
            Try
                Dim pos As New Point(ListBox1.Text, ListBox2.Text)
                Cursor.Position = pos
                ListBox1.SelectedIndex = ListBox1.SelectedIndex + +1
                ListBox2.SelectedIndex = ListBox2.SelectedIndex + +1
            Catch ex As Exception
                play_tmr.Stop()
            End Try
        End Sub

        Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
            rec_tmr.Start()
        End Sub

        Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
            rec_tmr.Stop()
            play_tmr.Stop()
        End Sub

        Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
            play_tmr.Start()
            ListBox1.SelectedIndex = "0"
            ListBox2.SelectedIndex = "0"
        End Sub

        Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
            ListBox1.Items.Clear()
            ListBox2.Items.Clear()
        End Sub
        Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vkey As Long) As Integer
        Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
            Dim hotkey As Boolean
            hotkey = GetAsyncKeyState(Keys.F7)
            If hotkey = True Then
                rec_tmr.Stop()
                play_tmr.Stop()
            End If
        End Sub

        Private Sub Timer2_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer2.Tick
            Dim hotkey As Boolean
            hotkey = GetAsyncKeyState(Keys.F6)
            If hotkey = True Then
                rec_tmr.Start()
            End If
        End Sub

        Private Sub Timer3_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer3.Tick
            Dim hotkey As Boolean
            hotkey = GetAsyncKeyState(Keys.F8)
            If hotkey = True Then
                play_tmr.Start()
                ListBox1.SelectedIndex = "0"
                ListBox2.SelectedIndex = "0"
            End If
        End Sub
    End Class

    please help me:(

    Monday, December 6, 2010 7:13 PM