module

AutoClick::User32

Windows User32 API bindings for AutoClick

This module provides Crystal bindings for the Windows User32.dll functions needed for mouse and keyboard automation.

Instance methods

get_cursor_pos(point : Bytes) : Int32

Get current cursor position

  • point: Byte buffer to store the position (8 bytes for x,y coordinates) Returns: 1 on success, 0 on failure
Source
get_double_click_time

Get system double-click time (milliseconds)

Source
get_key_state(virt_key : Int32) : Int16

Get the state of a virtual key

  • virt_key: Virtual key code Returns: Key state (negative if pressed, positive if toggled on)
Source
get_system_metrics(index : Int32) : Int32

Get system metrics

  • index: System metric index (0=screen width, 1=screen height) Returns: The requested system metric value
Source
send_input(count : UInt32, inputs : Bytes, input_size : Int32) : UInt32

Send input events to the system

New canonical order matching WinAPI: UINT SendInput(UINT cInputs, LPINPUT pInputs, int cbSize);

  • count: Number of INPUT structures
  • inputs: Concatenated INPUT structure bytes
  • input_size: Size of a single INPUT structure Returns: Number of events successfully inserted into the input stream
Source
send_input(inputs : Bytes, count : UInt32, input_size : Int32) : UInt32

Deprecated legacy parameter order kept for backward compatibility. Will be removed in a future minor release.

Source
set_cursor_pos(x : Int32, y : Int32) : Int32

Set cursor position

  • x: X coordinate in pixels
  • y: Y coordinate in pixels Returns: 1 on success, 0 on failure
Source