Results 1 to 2 of 2

Thread: [RESOLVED] Sendkeys?

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Jun 2008
    Posts
    1,023

    Resolved [RESOLVED] Sendkeys?

    I wish to send a keystroke to an application, but the problem I have is that, I wish the application to simulate the keyboard even more, by adding a delay between the KeyDown and KeyUp events while it sends the keystroke, is this possible in vb.net? (Don't ask me for a code, I don't have any, that's why I ask for help.)


    Found a solution:

    http://www.pinvoke.net/default.aspx/user32.keybd_event
    Last edited by Justa Lol; Oct 13th, 2014 at 07:35 AM.

  2. #2
    Super Moderator dday9's Avatar
    Join Date
    Mar 2011
    Location
    South Louisiana
    Posts
    11,715

    Re: [RESOLVED] Sendkeys?

    The solution is the same thing that I was going to suggest: Threading.Thread.Sleep. There is no need to use keybd_event in this case, just use SendKeys:
    Code:
    Private Sub MimicTyping(ByVal keys() As String)
    
        For Each keystroke As String In keys
            'Send the key
            SendKeys.Send(keystroke)
    
            'Zzz
            Threading.Thread.Sleep(150)
        Next
    
    End Sub
    "Code is like humor. When you have to explain it, it is bad." - Cory House
    VbLessons | Code Tags | Sword of Fury - Jameram

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