En masse, gibt's die, hier eines das ich grad zur Hand hab: (afair von Cybersam)
Code:
module Mouse
  gsm = Win32API.new('user32', 'GetSystemMetrics', 'i', 'i')
  #--------------------------------------------------------------------------
  @cursor_pos = Win32API.new('user32', 'GetCursorPos', 'p', 'i')
  #--------------------------------------------------------------------------
  $RMouse_BUTTON_L = 0x01        # left mouse button
  $RMouse_BUTTON_R = 0x02        # right mouse button
  $RMouse_BUTTON_M = 0x04        # middle mouse button
  $RMouse_BUTTON_4 = 0x05        # 4th mouse button
  $RMouse_BUTTON_5 = 0x06        # 5th mouse button
  #--------------------------------------------------------------------------
  GetKeyState = Win32API.new("user32","GetAsyncKeyState",['i'],'i')
  GetKeyboardState = Win32API.new("user32","GetKeyState",['i'],'i')
  GetSetKeyState = Win32API.new("user32","SetKeyboardState",['i'],'i')
  #--------------------------------------------------------------------------
  module_function
  #--------------------------------------------------------------------------
  def mouse_global_pos
    pos = [0, 0].pack('ll')
    if @cursor_pos.call(pos) != 0
      return pos.unpack('ll')
    else
      return nil
    end
  end
  #--------------------------------------------------------------------------
  def mouse_pos(catch_anywhere = false)
    x, y = screen_to_client(*mouse_global_pos)
    width, height = client_size
    if catch_anywhere or (x >= 0 and y >= 0 and x < width and y < height)
      return x, y
    else
      return $m.x, $m.y
    end
  end
  #--------------------------------------------------------------------------
  def del
    if @oldcursor == nil
      return
    else
      @SetClassLong.call(handel ,-12, @oldcursor)
      @oldcursor = nil
    end
  end
  #--------------------------------------------------------------------------
  def keyb(rkey)
     if GetKeyState.call(rkey) != 0
       return 1
     end
     return 0
  end
  #--------------------------------------------------------------------------
  def keyboard(rkey)
    GetKeyState.call(rkey) & 0x01 == 1  #
  end
  #--------------------------------------------------------------------------
  def key(rkey, key = 0)
    GetKeyboardState.call(rkey) & 0x01 == key #
  end
end

$scr2cli = Win32API.new('user32', 'ScreenToClient', %w(l p), 'i')
$client_rect = Win32API.new('user32', 'GetClientRect', %w(l p), 'i')
$readini = Win32API.new('kernel32', 'GetPrivateProfileStringA', %w(p p p p l p), 'l')
$findwindow = Win32API.new('user32', 'FindWindowA', %w(p p), 'l')

def screen_to_client(x, y)
  return nil unless x and y
  pos = [x, y].pack('ll')
  if $scr2cli.call(hwnd, pos) != 0
    return pos.unpack('ll')
  else
    return nil
  end
end

def hwnd
  game_name = "\0" * 256
  $readini.call('Game','Title','',game_name,255,".\\Game.ini")
  game_name.delete!("\0")
  return $findwindow.call('RGSS Player',game_name)
end

def client_size
  rect = [0, 0, 0, 0].pack('l4')
  $client_rect.call(hwnd, rect)
  right, bottom = rect.unpack('l4')[2..3]
  return right, bottom
end