#随主窗口移动而移动
hm = Win32API.new('kernel32','GetModuleHandleA','p','l').call('RGSS103J')
code = [139,68,36,4,139,128,196,182,18,0,139,64,8,194,16,0].pack('C*')
$main_hwnd = Win32API.new('user32.dll','CallWindowProc','pllll','l').call(code,hm,0,0,0)
xy = ' '*16
Win32API.new('user32','GetWindowRect','lp','v').call($main_hwnd,xy)
$main_xy = xy.unpack('ll')
class << Graphics
GetWindowRect = Win32API.new('user32','GetWindowRect','lp','v')
MoveWindow = Win32API.new('user32','MoveWindow','llllll','l')
alias e_update update
def update
xy = ' '*16
GetWindowRect.call($main_hwnd,xy)
if (xy1 = xy.unpack('ll')) != $main_xy
GetWindowRect.call(Ewindow::Hwnd,xy)
xy2 = xy.unpack('llll')
MoveWindow.call(Ewindow::Hwnd,xy2[0]+xy1[0]-$main_xy[0],
xy2[1]+xy1[1]-$main_xy[1],
xy2[2]-xy2[0],
xy2[3]-xy2[1],0)
$main_xy = xy1
end
e_update
end
end
#随主窗口移动而移动
hm = Win32API.new('kernel32','GetModuleHandleA','p','l').call('RGSS103J')
code = [139,68,36,4,139,128,196,182,18,0,139,64,8,194,16,0].pack('C*')
$main_hwnd = Win32API.new('user32.dll','CallWindowProc','pllll','l').call(code,hm,0,0,0)
xy = ' '*16
Win32API.new('user32','GetWindowRect','lp','v').call($main_hwnd,xy)
$main_xy = xy.unpack('ll')
class << Graphics
GetWindowRect = Win32API.new('user32','GetWindowRect','lp','v')
MoveWindow = Win32API.new('user32','MoveWindow','llllll','l')
alias e_update update
def update
xy = ' '*16
GetWindowRect.call($main_hwnd,xy)
if (xy1 = xy.unpack('ll')) != $main_xy
GetWindowRect.call(Ewindow::Hwnd,xy)
xy2 = xy.unpack('llll')
MoveWindow.call(Ewindow::Hwnd,xy2[0]+xy1[0]-$main_xy[0],
xy2[1]+xy1[1]-$main_xy[1],
xy2[2]-xy2[0],
xy2[3]-xy2[1],0)
$main_xy = xy1
end
e_update
end
end