本帖最后由 ppspssss 于 2019-1-15 22:32 编辑 https://rpg.blue/thread-168510-1-1.html <<<这个就是例子,不过不是RMXP 第一种要API方面的專家 @hyrious @War3Badboy ...
查看全部评分
# 取得窗口句柄HWND = Win32API.new('user32', 'GetActiveWindow', nil, 'l').call # 取得客户区矩形client_rect = "\0" * 16Win32API.new('user32', 'GetClientRect', 'lp', 'i').call(HWND, client_rect)ary = client_rect.unpack('llll')point_ul = ary[0..1].pack('ll')point_lr = ary[2..3].pack('ll')CTS = Win32API.new('user32', 'ClientToScreen', 'lp', 'i')CTS.call(HWND, point_ul)CTS.call(HWND, point_lr)client_rect = (point_ul.unpack('ll') + point_lr.unpack('ll')).pack('llll') # 限制鼠标Win32API.new('user32', 'ClipCursor', 'p', 'l').call(client_rect) # 解除限制Win32API.new('user32', 'ClipCursor', 'p', 'l').call(nil)
# 取得窗口句柄 HWND = Win32API.new('user32', 'GetActiveWindow', nil, 'l').call # 取得客户区矩形 client_rect = "\0" * 16 Win32API.new('user32', 'GetClientRect', 'lp', 'i').call(HWND, client_rect) ary = client_rect.unpack('llll') point_ul = ary[0..1].pack('ll') point_lr = ary[2..3].pack('ll') CTS = Win32API.new('user32', 'ClientToScreen', 'lp', 'i') CTS.call(HWND, point_ul) CTS.call(HWND, point_lr) client_rect = (point_ul.unpack('ll') + point_lr.unpack('ll')).pack('llll') # 限制鼠标 Win32API.new('user32', 'ClipCursor', 'p', 'l').call(client_rect) # 解除限制 Win32API.new('user32', 'ClipCursor', 'p', 'l').call(nil)
折叠内容标题(非必须)
折叠内容
站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作
GMT+8, 2024-11-27 12:47
Powered by Discuz! X3.1
© 2001-2013 Comsenz Inc.