Win32 Borderless Fullscreen Window

Started by
7 comments, last by SmkViper 8 years, 3 months ago

Hey all. I want to have a borderless fullscreen window that show's the title bar (ONLY the title bar, no other borders), when the user mouses to the top-right of the window. I will have no trouble implementing the last part, but I cannot figure out a combination of Window Styles to achieve only showing the title bar and no other borders. My results are either all borders showing or no borders showing.

Thank you in advance,

BagelBytes.

Advertisement

That unfortunately doesn't work directly. WS_CAPTION includes WS_BORDER automatically.

You could either accept the border, but move if off screen (place the window at negative coordinates, so that the caption and client area cover the screen).

Or, manually draw the caption in the client are.

Fruny: Ftagn! Ia! Ia! std::time_put_byname! Mglui naflftagn std::codecvt eY'ha-nthlei!,char,mbstate_t>

That unfortunately doesn't work directly. WS_CAPTION includes WS_BORDER automatically.

You could either accept the border, but move if off screen (place the window at negative coordinates, so that the caption and client area cover the screen).

Or, manually draw the caption in the client are.

I figured that WS_CAPTION ^ WS_BORDER would remedy the issue but that just removes the entire border, title bar included. What would you personally recommend for doing what I want out of the two options you gave?

What about just rendering a fake title bar inside the client area when the mouse is close enough to the top of the window?

I figured it out. What I ended up doing was creating a child window and positioning it at <0, 0>, dimensions <width, 0>, and just hiding it until the mouse is in trigger area.

hm, WM_POPUP doens't have border?

hm, WM_POPUP doens't have border?

No. Well it's irrelevant - in Windows, a window can not natively have a caption bar without having borders. Well, not trivially at least. You would have to handle WM_NCHITTEST and WM_NCPAINT and other related messages to create your own user-defined caption area, but really, I don't see the point. When a window is maximized, Windows will hide its borders anyway.


When a window is maximized, Windows will hide its borders anyway.

Yes, but if you need to minimize/exit, the title bar appears when you hover your mouse near it. I have that working, I just need to figure out how to make it non-movable. I guess I handle WM_SYSCOMMAND for that.

Most games that do this kind of thing just don't use the titlebar at all and draw their own minimize/maximize/close buttons using their existing UI code. You can even detect when the game isn't fullscreen/fullscreen windowed and not draw those buttons in that case, letting the user use the actual window buttons in the visible titlebar.

Saves a lot of headache smile.png

This topic is closed to new replies.

Advertisement