| 赞 | 0 |
| VIP | |
| 好人卡 | |
| 积分 | 1 |
| 经验 | |
| 最后登录 | 2012-5-12 |
| 在线时间 | 27 小时 |
- 梦石
- 0
- 星屑
- 50
- 在线时间
- 27 小时
- 注册时间
- 2011-4-24
- 回帖
- 55
|
发表于 2012-2-7 19:42:32
|
显示全部楼层
本帖最后由 凌依约 于 2012-2-7 19:48 编辑
@dant@各种压力的猫君- #----------------------------------------------------------------------------
- # 有条件地显示鼠标
- #
- # 作者:凌依约
- # VX 测试通过,理论支持VA&XP
- # 使用方法:插入脚本后在任意处调用Mouse_Hide.conditionally_mouse_hide即可
- #----------------------------------------------------------------------------
- module Mouse_Hide
-
- # 各种API定义
- GetWindowText = Win32API.new('user32', 'GetWindowTextA' , %w(l p l), 'l')
- WinFromPoint = Win32API.new('user32', 'WindowFromPoint', %w(l l), 'l')
- GetCursorPos = Win32API.new('user32', 'GetCursorPos' , %w(p), 'l')
- ShowCursor = Win32API.new('user32', 'ShowCursor' , %w(l), 'l')
- module_function
- def mouse_pos
- pos = [0, 0].pack('ll')
- GetCursorPos.call(pos)
- return pos.unpack('ll')
- end # def
- def window_pos
- pos = [0, 0].pack('ll')
- WinFromPoint.call(pos)
- return pos.unpack('ll')
- end # def
-
- def window_rect
- rect = [0, 0, 0, 0].pack('ll')
- WinFromPoint.call(get_hWnd,rect)
- return pos.unpack('llll')
- end # def
-
- def m_inside
- ahwnd = WinFromPoint.call(mouse_pos[0],mouse_pos[1]) # 获取鼠标位置的句柄
- return ahwnd == get_hWnd
- end
- def conditionally_mouse_hide
- ShowCursor.call(0) if m_inside # 如果在范围就隐藏
- ShowCursor.call(1) if !m_inside # 如果不在范围就显示
- end
- end#module
- #==============================================================================
- # ■ Kernel
- #------------------------------------------------------------------------------
- # 该模块中定义了可供所有类使用的方法。Object 类中包含了该模块。
- #==============================================================================
- module Kernel
- #--------------------------------------------------------------------------
- # ● 需要的 Windows API 函数
- #--------------------------------------------------------------------------
- GetWindowThreadProcessId = Win32API.new("user32", "GetWindowThreadProcessId", "LP", "L")
- GetWindow = Win32API.new("user32", "GetWindow", "LL", "L")
- GetClassName = Win32API.new("user32", "GetClassName", "LPL", "L")
- GetCurrentThreadId = Win32API.new("kernel32", "GetCurrentThreadId", "V", "L")
- GetForegroundWindow = Win32API.new("user32", "GetForegroundWindow", "V", "L")
- #--------------------------------------------------------------------------
- # ● 获取窗口句柄
- #--------------------------------------------------------------------------
- def get_hWnd
- # 获取调用线程(RM 的主线程)的进程标识
- threadID = GetCurrentThreadId.call
- # 获取 Z 次序中最靠前的窗口
- hWnd = GetWindow.call(GetForegroundWindow.call, 0)
- # 枚举所有窗口
- while hWnd != 0
- # 如果创建该窗口的线程标识匹配本线程标识
- if threadID == GetWindowThreadProcessId.call(hWnd, 0)
- # 分配一个 11 个字节的缓冲区
- className = " " * 11
- # 获取该窗口的类名
- GetClassName.call(hWnd, className, 12)
- # 如果匹配 RGSS Player 则跳出循环
- break if className == "RGSS Player"
- end
- # 获取下一个窗口
- hWnd = GetWindow.call(hWnd, 2)
- end
- return hWnd
- end
- end
复制代码 手头没ACE,VX测试通过,猫君大大应该要的就是这个效果吧?
PS:..蛋疼啊...
Thread.new{Win32API.new('user32', 'ShowCursor' , %w(l), 'l').call(0)}
就可以在只客户端显示区域隐藏了 还费这么大力 ORZ
|
|