Project1

标题: 请问有什么方法能够动态修改游戏窗口的标题? [打印本页]

作者: 赛露休斯    时间: 2014-12-10 00:37
标题: 请问有什么方法能够动态修改游戏窗口的标题?
就是游戏窗口上的标题

比如游戏进行到一定时可以修改标题的那种,有办法修改吗?
我用API修改,但每次它都会变回来
作者: VIPArcher    时间: 2014-12-10 10:51
https://rpg.blue/thread-367933-1-1.html
作者: 赛露休斯    时间: 2014-12-10 16:27
VIPArcher 发表于 2014-12-10 10:51
https://rpg.blue/thread-367933-1-1.html

里面大部分的方法都是通过修改Game.ini来实现的,然后需要退出重启游戏
但游戏玩了一半(比如一个章节换一个标题),突然退出重启明显不适合
作者: 赛露休斯    时间: 2014-12-10 17:43
说明一下,单单用SetWindowText来改是没有用的,就像主楼说的那样,我用API修改,但每次它都会变回来,确切说是Graphics.update一下又会变回来的
  1. module Kernel
  2.   GetWindowThreadProcessId = Win32API.new("user32", "GetWindowThreadProcessId", "LP", "L")
  3.   GetWindow = Win32API.new("user32", "GetWindow", "LL", "L")
  4.   GetClassName = Win32API.new("user32", "GetClassName", "LPL", "L")
  5.   GetCurrentThreadId = Win32API.new("kernel32", "GetCurrentThreadId", "V", "L")
  6.   GetForegroundWindow = Win32API.new("user32", "GetForegroundWindow", "V", "L")
  7.   def get_hWnd
  8.     threadID = GetCurrentThreadId.call
  9.     hWnd = GetWindow.call(GetForegroundWindow.call, 0)
  10.     while hWnd != 0
  11.       if threadID == GetWindowThreadProcessId.call(hWnd, 0)
  12.         className = " " * 11
  13.         GetClassName.call(hWnd, className, 12)
  14.         break if className == "RGSS Player"
  15.       end
  16.       hWnd = GetWindow.call(hWnd, 2)
  17.     end
  18.     return hWnd
  19.   end
  20. end

  21. SetWindowText = Win32API.new 'user32', 'SetWindowText', 'lp', 'l'
  22. SetWindowText.call get_hWnd, "Hello World"

  23. msgbox 1 #这时是新标题
  24. Graphics.update
  25. msgbox 2 #Graphics.update以后又变回来
复制代码
这种情况要怎么处理?
作者: taroxd    时间: 2014-12-11 12:30
赛露休斯 发表于 2014-12-10 17:43
说明一下,单单用SetWindowText来改是没有用的,就像主楼说的那样,我用API修改,但每次它都会变回来,确切 ...

我也不清楚,大不了每帧都改
作者: 赛露休斯    时间: 2014-12-11 19:02
taroxd 发表于 2014-12-11 12:30
我也不清楚,大不了每帧都改

每帧都改好像不太行呢,主要是不知道Graphics.update这个方法里都做了些什么
如果只是用alias修改,标题会不断的改过去改回来,而且游戏运行速度也会变慢
作者: 赛露休斯    时间: 2014-12-19 07:33
180小时自顶一次
期待技术高手来解决这个疑难杂症





欢迎光临 Project1 (https://rpg.blue/) Powered by Discuz! X3.1