check out KeyboardProc in the help..