Get cursor position with Win32API : Win32API « Windows Platform « Ruby






Get cursor position with Win32API


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

 








Related examples in the same category

1.Use Win32API to get a pointer a function
2.Read from keyboard
3.Working with Microsoft Windows: open a dialog box:
4.Open a dialog and check the result