查看: 1433|回复: 0

[已经解决] 看吧

  [复制链接]
梦石
0
星屑
660
在线时间
13 小时
注册时间
2011-6-7
回帖
2
发表于 2011-7-1 19:52:56 | 显示全部楼层 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有账号?注册会员

×
本帖最后由 幻域三影 于 2011-7-1 19:53 编辑

调分辨率用这个,不过有点漏洞啊·····



# ————————————————————————————————————
# 分辨率放大
# ————————————————————————————————————

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 = 1024
$height = 768
win = Win32API.SetWindowPos($width, $height)
if(win == 0)
  p "Size change has failed!"
end
您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖返回顶部