Results 1 to 3 of 3

Thread: keybd_event

  1. #1
    Platinum Lounger
    Join Date
    Feb 2001
    Location
    Yilgarn region of Toronto, Ontario
    Posts
    5,453
    Thanks
    0
    Thanked 0 Times in 0 Posts

    keybd_event

    I'd like to know more about this. I have searched the Forum to no avail.


    I'm interested in trapping/timing keystrokes. Kevin's Format("ms") and the keyDown events etc of a WORD97 GUI seem to give me accuracy to the nearest 1/8 of a second.


    I found a reference to keybd_event in the APINet stuff, byt can't locate an example that shows me what I might actually DO with keybd_event.


    I'd love to get either an example of use, or better still, instructions on how to learn about something when I know only to declare it as follows:

    <pre>Public Declare Sub keybd_event Lib "user32" (ByVal bVk As Byte,_
    ByVal bScan As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo As Long)
    </pre>



    Posted below are my efforts to date, from a form with a single text box and a single command button:

    <pre>Public TimeInDown
    Public TimeInPress
    Public TimeInUp
    Public TimeDownLapsed
    Public TimePressLapsed
    Public TimeUpLapsed

    Private Sub cmdOK_Click()
    Unload Me
    End Sub

    Private Sub tbString_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, _
    ByVal Shift As Integer)
    TimeInDown = Time
    TimeDownLapsed = Time - TimeInUp
    Debug.Print "TimeDownLapsed " & Chr$(9) & Format(TimeDownLapsed, "ss.ms")
    End Sub

    Private Sub tbString_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
    TimeInPress = Time
    TimePressLapsed = Time - TimeInDown
    Debug.Print "TimePressLapsed " & Chr$(9) & Format(TimePressLapsed, "ss.ms")
    End Sub

    Private Sub tbString_KeyUp(ByVal KeyCode As MSForms.ReturnInteger, _
    ByVal Shift As Integer)
    TimeInUp = Time
    TimeUpLapsed = Time - TimeInPress
    Debug.Print "TimeUpLapsed " & Chr$(9) & Format(TimeUpLapsed, "ss.ms")
    End Sub
    </pre>


  2. #2
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    Cornwall, England
    Posts
    393
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: keybd_event

    Chris, whenever i get stuck with an API function i go to <A target="_blank" HREF=http://www.allapi.net>http://www.allapi.net</A>. They have a great database to download that lists over 700 functions with descriptions, examples, etc in great detail. On the site you can post a question that should get the response that you need.
    good luck

  3. #3
    Platinum Lounger
    Join Date
    Feb 2001
    Location
    Yilgarn region of Toronto, Ontario
    Posts
    5,453
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: keybd_event

    Thanks daddyo. I did d/l their all-in-one kit and started to browse it. It has examples (I did up the one that enters keystrokes into a GUI form field) but I couldn't work out how to time the keyboard event. I'll wade through the 700+ examples tonight ot tomorrow morning.

Posting Permissions

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