Project1
标题:
【求教】如何隐藏标题栏
[打印本页]
作者:
shanwenxiu2013
时间:
2014-7-28 11:50
标题:
【求教】如何隐藏标题栏
本帖最后由 shanwenxiu2013 于 2014-7-28 11:52 编辑
如上两图,一般的会有标题栏,求助怎样可以隐藏标题栏变成下边这种样式。
作者:
VIPArcher
时间:
2014-7-28 12:00
Main上面找个顺眼的地方插进去
# (WinUser.h 中的一些宏)
# GWL_STYLE = -16
# WS_CAPTION = 0x00C00000L
# SM_CXSCREEN = 0
# SM_CYSCREEN = 1
# SWP_FRAMECHANGED = 0x0020
# 防止 F12 后再次执行
if $START_NOCAPTION == nil
$START_NOCAPTION = 1
getPrivateProfileString = Win32API.new("kernel32", "GetPrivateProfileString", ['P', 'P', 'P', 'P', 'L', 'P'], 'L')
findWindow = Win32API.new("user32", "FindWindow", ['P', 'P'], 'L')
getWindowLong = Win32API.new("user32", "GetWindowLong", ['L', 'I'], 'L')
setWindowLong = Win32API.new("user32", "SetWindowLong", ['L', 'I', 'L'], 'L')
getSystemMetrics = Win32API.new("user32", "GetSystemMetrics", ['I'], 'I')
setWindowPos = Win32API.new("user32", "SetWindowPos",['L', 'L', 'I', 'I', 'I', 'I', 'I'], 'L')
# 分配字符串缓冲区
title = " " * 128
# 通过读取 Game.ini 获取窗口标题
getPrivateProfileString.call("Game", "Title", "", title, 128, "./Game.ini")
# 通过窗口类名和标题获取窗口句柄
hWnd = findWindow.call('RGSS Player', title)
# 获取窗口样式
style = getWindowLong.call(hWnd, -16)
# 去掉 WS_CAPTION 样式
style &= ~0x00C00000
# 应用新样式
setWindowLong.call(hWnd, -16, style)
# 获取屏幕尺寸
scr_width = getSystemMetrics.call(0)
scr_height = getSystemMetrics.call(1)
# 更新窗口框架并居中
setWindowPos.call(hWnd, 0, (scr_width - 544) / 2, (scr_height - 416) / 2, 544, 416, 0x0020)
end
复制代码
作者:
shanwenxiu2013
时间:
2014-7-28 12:31
VIPArcher 发表于 2014-7-28 12:00
Main上面找个顺眼的地方插进去
试了,很好用,伸手党表示太感谢了。 多问一句我试的时候都是打开一闪,标题栏消失。有没有直接就不显示标题栏的呢。
作者:
shanwenxiu2013
时间:
2014-7-28 12:39
@余烬之中
求问大神。用了楼上脚本后实现了隐藏标题栏。是打开之后显示0.5秒然后消失。请问有什么办法可以让它彻底不显示的。多谢!!
作者:
余烬之中
时间:
2014-7-28 13:22
VIPArcher 发表于 2014-7-28 12:00
Main上面找个顺眼的地方插进去
那个0.5秒大约是等加载?不用外部调用的话貌似不行的样子…………
所以我只是来提供一个精简三行无注释版的……
hwnd = Win32API.new("user32", "GetActiveWindow", nil, 'i').call
Win32API.new("user32", "SetWindowLong", 'iil', 'l').call hwnd, -16,
Win32API.new("user32", "GetWindowLong", 'ii', 'l').call(hwnd, -16) & ~0x00C00000
复制代码
欢迎光临 Project1 (https://rpg.blue/)
Powered by Discuz! X3.1