Results 1 to 13 of 13

Thread: SendKeys - Hold Down a Key

Hybrid View

  1. #1
    PowerPoster dunfiddlin's Avatar
    Join Date
    Jun 2012
    Posts
    8,245

    Re: SendKeys - Hold Down a Key

    100ms will give you 10 per second which seems reasonable. Fastest available in Windows is around 30 per second, slowest around 3. Anything much faster than 10 will put you in less reliable timer country however.
    As the 6-dimensional mathematics professor said to the brain surgeon, "It ain't Rocket Science!"

    Reviews: "dunfiddlin likes his DataTables" - jmcilhinney

    Please be aware that whilst I will read private messages (one day!) I am unlikely to reply to anything that does not contain offers of cash, fame or marriage!

  2. #2

    Thread Starter
    Addicted Member HunterTTP's Avatar
    Join Date
    Jul 2012
    Posts
    146

    Arrow Re: SendKeys - Hold Down a Key

    Quote Originally Posted by dunfiddlin View Post
    100ms will give you 10 per second which seems reasonable. Fastest available in Windows is around 30 per second, slowest around 3. Anything much faster than 10 will put you in less reliable timer country however.
    Alright well here is my code so far. The problem is that it freezes the program and sometimes even my computer. But it does everything else correctly. I was thinking about using a BackgroundWorker but how would I stop it once it started?

    Code:
    Imports System
    Imports System.IO
    Imports Microsoft.VisualBasic
    Public Class Form1
    
        Private Sub CheckBox1_CheckedChanged(sender As Object, e As EventArgs) Handles CheckBox1.CheckedChanged
    
            Dim X As Integer
            X = 1
    
            If CheckBox1.Checked Then
                Do While X = 1
                    SendKeys.Send("W")
                    Threading.Thread.Sleep(25)
                Loop
            End If
    
        End Sub
    End Class

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