Wrox Home  
Search P2P Archive for: Go

  Return to Index  

pro_vb thread: More key press on a form


Message #1 by ej.cutshall@i... on Thu, 25 Jul 2002 19:26:53
MS confirmed that SendKeys may not work on some OSes and reccomends using 
the Keybd_Event API. Here's an example using the API in a form

Const VK_TAB = &H9
Declare Sub keybd_event Lib "user32" (  _
          ByVal bVk As Byte, ByVal bScan As Byte, _
          ByVal dwFlags As Long, ByVal dwExtraInfo As Long _
                                      )


Private Sub Text1_KeyDown(KeyCode As Integer, Shift As Integer)
     If KeyCode = vbKeyReturn Then
         KeyCode = 0
         keybd_event VK_TAB, 0, 0, 0
     End If
End Sub

Regards,
-Toby


>From: ej.cutshall@i...
>Date: Thu, 25 Jul 2002 19:26:53
>Reply-To: "professional vb" <pro_vb@p...>
>
>Hi,
>
>Are there OS settings that preclude the sendkeys from working?  My app
>works fine sending Tab when Enter key pressed on all Win98 2nd Ed.
>installs except for two machines.  Got any ideas?
>
>Thanks,


  Return to Index