赞 | 0 |
VIP | 0 |
好人卡 | 0 |
积分 | 1 |
经验 | 0 |
最后登录 | 2012-5-26 |
在线时间 | 13 小时 |
Lv1.梦旅人
- 梦石
- 0
- 星屑
- 660
- 在线时间
- 13 小时
- 注册时间
- 2011-6-7
- 帖子
- 3
|
用这个试试看
# ————————————————————————————————————
# 分辨率放大
# ————————————————————————————————————
class Win32API
GAME_INI_FILE = ".\\Game.ini"
HWND_TOPMOST = 0
HWND_TOP = -1
SWP_NOMOVE = 0
SWP_FRAMECHANGED = 0
HWND_NOTTOPMOST = 0
WM_GETMINMAXINFO = 24
#——————————————————————————————————————
def Win32API.GetPrivateProfileString(section, key)
val = "\0"*256
gps = Win32API.new('kernel32', 'GetPrivateProfileString',%w(p p p p l p), 'l')
gps.call(section, key, "", val, 256, GAME_INI_FILE)
val.delete!("\0")
return val
end
#——————————————————————————————————————
def Win32API.FindWindow(class_name, title)
fw = Win32API.new('user32', 'FindWindow', %(p, p), 'i')
hWnd = fw.call(class_name, title)
return hWnd
end
#——————————————————————————————————————
def Win32API.SetWindowPos(w, h)
title = Win32API.GetPrivateProfileString("Game", "Title")
hWnd = Win32API.FindWindow("RGSS Player", title)
swp = Win32API.new('user32', 'SetWindowPos', %(l, l, i, i, i, i, i), 'i')
win = swp.call(hWnd, HWND_TOP, -3, -22, w + 6, h+32, WM_GETMINMAXINFO)
return win
end
#——————————————————————————————————————
def Win32API.client_size
title = Win32API.GetPrivateProfileString("Game", "Title")
hWnd = Win32API.FindWindow("RGSS Player", title)
rect = [0, 0, 0, 0].pack('l4')
Win32API.new('user32', 'GetClientRect', %w(l p), 'i').call(hWnd, rect)
width, height = rect.unpack('l4')[2..3]
return width, height
end
end
$width = 800
$height = 600
win = Win32API.SetWindowPos($width, $height)
if(win == 0)
p "Size change has failed!"
end
|
|