- require 'Win32API'
- def getch
- @getch ||= Win32API.new('crtdll', '_getch', [], 'L')
- @getch.call
- end
- while (c = getch) != ?\e
- puts "You typed #{c.chr.inspect}"
- end
- result = "0"*8 # Eight bytes (enough for two longs)
- getCursorXY = Win32API.new("user32","GetCursorPos",["P"],"V")
- getCursorXY.call(result)
- x, y = result.unpack("LL") # Two longs