VERSION 5.00
Begin VB.Form Form1 
   Caption         =   "Key Counter"
   ClientHeight    =   3450
   ClientLeft      =   60
   ClientTop       =   450
   ClientWidth     =   5655
   Icon            =   "Form1.frx":0000
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   ScaleHeight     =   3450
   ScaleWidth      =   5655
   StartUpPosition =   2  'CenterScreen
   Begin VB.CommandButton btnReset 
      Caption         =   "Reset"
      Default         =   -1  'True
      Height          =   495
      Left            =   1800
      TabIndex        =   1
      Top             =   2640
      Width           =   1815
   End
   Begin VB.TextBox Text1 
      Height          =   285
      Left            =   3960
      TabIndex        =   3
      Text            =   "F9"
      Top             =   210
      Width           =   615
   End
   Begin VB.Label Label2 
      AutoSize        =   -1  'True
      BackStyle       =   0  'Transparent
      Caption         =   "Count the number of times this key is pressed:"
      Height          =   195
      Left            =   600
      TabIndex        =   2
      Top             =   240
      Width           =   3225
   End
   Begin VB.Label lblCount 
      AutoSize        =   -1  'True
      BackStyle       =   0  'Transparent
      Caption         =   "0"
      BeginProperty Font 
         Name            =   "Arial"
         Size            =   92.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   2055
      Left            =   2280
      TabIndex        =   0
      Top             =   480
      Width           =   1020
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub btnReset_Click()
 key_count = 0
 lblCount.Caption = "0"
 lblCount.Left = 2275
End Sub

Private Sub Text1_Change()
 keycode_to_watch = WriteKeyCodeFromChar(Text1.Text)
End Sub

Private Sub Form_Load()
 key_count = 0
 keycode_to_watch = 120
 hHook = SetWindowsHookEx(WH_KEYBOARD_LL, AddressOf LowLevelKeyboardProc, App.hInstance, 0&)
End Sub

Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
 If (hHook <> 0) Then
  Call UnhookWindowsHookEx(hHook)
 End If
End Sub