La Web del Programador: Comunidad de Programadores
 
    Pregunta:  1087 - CAPTURAR EL TECLADO DESDE UN MODULO
Autor:  Pilar Training Center
Estor desarrolando mi aplicacion bajo VB5, y realmente he intentado muchas maneras para poder capturar el teclado desde un modulo sin la intervencion de un Form, aunque he probado haciendolo invisible, pero en cuanto pierdo el foco del Form adios!, ya no sirve. Entiendo el funcionamiento de la API de Windows pero me confundo con los parametros que requieren algunas de las funciones, es tema aparte y ya aprendere.

Mil Gracias


  Respuesta:  ivan c.
ESTO SE LOGRA CON UN API , TE DARE SOLO LA BASE, LO DEMAS DEPENDE DE TI.
Pon un Timer En tu Form:
Un Text box:
Option Explicit

Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Long) As Integer
Dim buffer As Integer

Private Sub Timer1_Timer()

Dim intAscii

For intAscii = 1 To 255
buffer = 0
buffer = GetAsyncKeyState(intAscii)

If buffer <> 0 Then
Text1.Text = Text1.Text & Chr(intAscii)
End If

Next

End Sub