简体   繁体   中英

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.

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? 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. 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. Now it's a case of having to remove both WS_CAPTION and WS_SYSMENU flags to make that titlebar disappear completely.

Posted on behalf of the question asker

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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