class RmWin
attr_accessor :left,:top,:right,:bottom
attr_accessor :hwnd
def initialize
@left = 0
@top = 0
@right = 0
@bottom = 0
@hwnd = 0
end
end
$rmWin = RmWin.new
window_Rect = Win32API.new("user32","GetWindowRect","lp","l")
val = "\0"*256
gps = Win32API.new("kernel32", "GetPrivateProfileString",%w(p p p p l p), "l")
gps.call("Game", "Title", "", val, 256, ".\\Game.ini")
val.delete!("\0")
fw = Win32API.new("user32", "FindWindow", %(p, p), "i")
$rmWin.hwnd = fw.call("RGSS Player", val)
pos = "\0"*16
result = window_Rect.call($rmWin.hwnd,pos)
if result != 0
rect = pos.unpack("C*")
end
$wndmove = false
posLeft,posTop,posRight,posBottom = 0,4,8,12
$rmWin.left = rect[posLeft+1] * 0xFF + rect[posLeft]
$rmWin.top = rect[posTop+1] * 0xFF + rect[posTop]
$rmWin.right = rect[posRight+1] * 0xFF + rect[posRight]
$rmWin.bottom = rect[posBottom+1] * 0xFF + rect[posBottom]
module Graphics
@ori = method("update") if @ori.nil?
@swp = Win32API.new("user32", "SetWindowPos", %(l, l, i, i, i, i, i),"'i")
def self.update(*args)
@ori.call(*args)
if $wndmove
left = $rmWin.left
top = $rmWin.top
@swp.call($rmWin.hwnd, -1, left, top, 640, 480, 1)
$wndmove = false
end
end
end
module Kernel
alias ori_exit exit unless method_defined? :exit
def exit(*args)
Graphics.freeze
Graphics.transition(20)
@sp = Sprite.new
@sp.x,@sp.y,@sp.z = 0,0,999999999
@sp.bitmap = Bitmap.new(640,480)
count = 0
size = 6
begin
count += 1
size += 1
@sp.bitmap.clear
@sp.bitmap.fill_rect(0,0,640,480,Color.new(0,0,0,255))
@sp.bitmap.font.size = size
@sp.bitmap.draw_text(0,200,640,100,"Thank You For Your Play",1)
Graphics.update
end until count == 40
20.times{Graphics.update}
ori_exit(*args)
end
end
#==============================================================================
# ■ RmWndProc
#------------------------------------------------------------------------------
# 处理RM窗口过程的模块。
#
# v1.1
#
# by 灼眼的夏娜
#
# ※ 这个模块名以及该模块中的方法名字请勿更改!!!
#==============================================================================
module RmWndProc
#--------------------------------------------------------------------------
# ● API函数声明
#--------------------------------------------------------------------------
Replace = Win32API.new("Lib/RmWndProc","_replace","v","i")
Restore = Win32API.new("Lib/RmWndProc","_restore","v","v")
#--------------------------------------------------------------------------
# ● 窗口过程函数 ※ 该名字切勿更改
#--------------------------------------------------------------------------
def self.wnd_proc(hwnd,msg,wparam,lparam)
# 消息分歧
case msg
when 0x0003
$wndmove = true
return
end
# 调用默认窗口过程
self.default_proc
end
#--------------------------------------------------------------------------
# ● 转换窗口到RM脚本中进行处理
#--------------------------------------------------------------------------
def self.replace
Replace.call
end
#--------------------------------------------------------------------------
# ● 还原窗口过程
#--------------------------------------------------------------------------
def self.restore
Restore.call
end
#--------------------------------------------------------------------------
# ● 默认窗口过程 ※ 对于没有进行处理的消息我们在最后调用该方法来调用默认窗
# 口过程。
#--------------------------------------------------------------------------
def self.default_proc
raise "default_proc"
end
end
RmWndProc.replace
#--------------------------------------------------------------------------
# ● 窗口过程函数 ※ 该名字切勿更改
#--------------------------------------------------------------------------
def self.wnd_proc(hwnd,msg,wparam,lparam)
# 消息分歧
case msg
when 0x00A1
return 0 if wparam == 2
end
# 调用默认窗口过程
self.default_proc
end
以下引用一路一风尘于2009-6-7 13:29:01的发言:
呵呵,移动与鼠标点击都算消息,应都可拦截。
以下引用一路一风尘于2009-6-7 13:48:06的发言:
WM_MOVE应可以直接吃掉?
欢迎光临 Project1 (https://rpg.blue/) | Powered by Discuz! X3.1 |