Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Removing window border?

I have a window with a solid border around it. How can I remove the border (all of the non-client area) by using SetWindowLong and GetWindowLong?

like image 306
Kristina Brooks Avatar asked Mar 08 '10 01:03

Kristina Brooks


People also ask

How do I get rid of the white border in windows 10?

Click on Colors; Scroll down and disable the option "Show accent color on title bars and windows borders"; So the white border will be removed; I hope I have helped, see you soon!

How do you remove unwanted borders?

Go to Design > Page Borders. In the Borders and Shading box, on the Page Border tab, select the arrow next to Apply to and choose the page (or pages) you want to remove the border from. Under Setting, select None, and then select OK.


1 Answers

In C/C++

LONG lStyle = GetWindowLong(hwnd, GWL_STYLE); lStyle &= ~(WS_CAPTION | WS_THICKFRAME | WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_SYSMENU); SetWindowLong(hwnd, GWL_STYLE, lStyle); 

WS_CAPTION is defined as (WS_BORDER | WS_DLGFRAME). You can get away with removing just these two styles, since the minimize maximize and sytem menu will disappear when the caption disappears, but it's best to remove them as well.

It's also best to remove the extended border styles.

LONG lExStyle = GetWindowLong(hwnd, GWL_EXSTYLE); lExStyle &= ~(WS_EX_DLGMODALFRAME | WS_EX_CLIENTEDGE | WS_EX_STATICEDGE); SetWindowLong(hwnd, GWL_EXSTYLE, lExStyle); 

And finally, to get your window to redraw with the changed styles, you can use SetWindowPos.

SetWindowPos(hwnd, NULL, 0,0,0,0, SWP_FRAMECHANGED | SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_NOOWNERZORDER); 
like image 94
John Knoeller Avatar answered Sep 20 '22 16:09

John Knoeller