getAsyncKeyState = Win32API.new('user32.dll', 'GetAsyncKeyState', 'i', 'i')
(1...0xFF).each do |i| 
  if getAsyncKeyState.call(i) != 0
    case i
      when 1, 2, 4
        print("鼠标键")
      when 0x30..0x39
        print("数字键")
      when 0x41..0x5A, 0x61..0x7A
        print("字母键")
      else
        print("其他按键")
    end
  end
end