The function does not hide the titlebar, instead it only hides the minimize/maximize/close buttons.
I'm trying to make the window completely borderless, so I can make an application that darkens everything around a game running in windowed mode.
These are the constants:
const uint SWP_FRAMECHANGED = 0x0020;
const uint SWP_NOMOVE = 0x0002;
const uint SWP_NOSIZE = 0x0001;
const uint SWP_NOZORDER = 0x0004;
const int GWL_STYLE = -16;
const long WS_BORDER = 0x00800000L;
const long WS_CAPTION = 0x00C00000L;
const long WS_SYSMENU = 0x00080000L;
This is the function:
IntPtr hWnd = CurrentWindowID;
long currentStyle = GetWindowLong(hWnd, GWL_STYLE);
// Remove WS_BORDER, WS_CAPTION, and WS_SYSMENU styles to make the window borderless
long newStyle = currentStyle & ~(WS_BORDER | WS_CAPTION | WS_SYSMENU);
// Update the window style
SetWindowLong(hWnd, GWL_STYLE, newStyle);
// Update the window position and size to apply the style change
SetWindowPos(hWnd, IntPtr.Zero, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_FRAMECHANGED);
The following code can completely remove the TitleBar
To