简体   繁体   English

如何彻底删除窗口标题栏?

[英]How to remove window title bar completely?

So, in the past, I used to be able to make a simple call like the one below to make a window without a title bar on it or border around it:所以,在过去,我曾经能够像下面这样进行一个简单的调用来制作一个没有标题栏或边框的窗口:

a = SetWindowLongA(hwnd, GWL_STYLE, winstyle AND NOT WS_BORDER);

I just tried the exact same style code earlier today on Windows 11, and things aren't performing as they used to.我刚刚在今天早些时候在 Windows 11 上尝试了完全相同的样式代码,但事情并没有像以前那样执行。

In the past, a window was created without ANY border or title bar.过去,创建的窗口没有任何边框或标题栏。 Now, my program is creating a window with a BLACK/blank title bar.现在,我的程序正在创建一个带有黑色/空白标题栏的窗口。 There's nothing there to interact with, but the window is still reserving real estate for the blank title bar, with the program window appearing below it (which causes issues with automated mouse clicks across various computers on our system with different size title bars and borders).没有什么可以交互的,但窗口仍然为空白标题栏保留空间,程序窗口出现在它下面(这会导致在我们系统上具有不同大小标题栏和边框的各种计算机上自动单击鼠标的问题) .

Is this a new, permanent, type behavior which Windows 11 is implementing?这是 Windows 11 正在实施的新的、永久的类型行为吗? A glitch which will be fixed in some future update?将在未来的更新中修复的故障? Or does anyone have a simple work-around for which I can fall back on until I can sort out why it USED to work but now doesn't?或者有没有人有一个简单的解决方法,我可以依靠它,直到我弄清楚为什么它曾经可以工作但现在不能工作?

I've finally sorted out the issue.我终于解决了这个问题。

Style = (WS_CAPTION | WS_SYSMENU); 
a = SetWindowLongA(hwnd, GWL_STYLE, winstyle & ~WS_BORDER);

The issue was coming from simply removing the WS_CAPTION and not also removing the WS_SYSMENU flag, which ends up with the title bar becoming black and blank, but not non-existent.问题来自简单地删除 WS_CAPTION 而不是同时删除 WS_SYSMENU 标志,这最终导致标题栏变为黑色和空白,但并非不存在。 I swear, in my memory, all I had to remove was the WS_CAPTION in the past (perhaps on 32-bit systems?), and it completely removed the title bar from a program, but things aren't behaving that way now.我发誓,在我的记忆中,过去我必须删除的只是 WS_CAPTION(可能在 32 位系统上?),它从程序中完全删除了标题栏,但现在情况并非如此。 Now it's a case of having to remove both WS_CAPTION and WS_SYSMENU flags to make that titlebar disappear completely.现在是必须同时删除 WS_CAPTION 和 WS_SYSMENU 标志才能使标题栏完全消失的情况。

Posted on behalf of the question asker代表提问者发布

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM