You just need WS_POPUP
and full screen width & height to hide the task bar. Here is example of changing window style after window is already shown:
if (msg == WM_LBUTTONDOWN)
{
if (GetWindowLongPtr(hwnd, GWL_STYLE) & WS_POPUP)
{
SetWindowLongPtr(hwnd, GWL_STYLE, WS_VISIBLE | WS_OVERLAPPEDWINDOW);
SetWindowPos(hwnd, NULL, 0, 0, 600, 400, SWP_FRAMECHANGED);
}
else
{//show full-screen
int w = GetSystemMetrics(SM_CXSCREEN);
int h = GetSystemMetrics(SM_CYSCREEN);
SetWindowLongPtr(hwnd, GWL_STYLE, WS_VISIBLE | WS_POPUP);
SetWindowPos(hwnd, HWND_TOP, 0, 0, w, h, SWP_FRAMECHANGED);
}
}
Or to show with initial full-screen size:
int w = GetSystemMetrics(SM_CXSCREEN);
int h = GetSystemMetrics(SM_CYSCREEN);
HWND hmain = CreateWindow(L"className", L"title", WS_POPUP, 0, 0, w, h, 0, 0, hInst, 0);
ShowWindow(hmain, SW_SHOW);
Windows are either WS_OVERLAPPED
, WS_POPUP
, or WS_CHILD
. These three flags can't be combined with each other, but they can be combined with other WS_XXXX
flags.
Top windows are either WS_OVERLAPPED
or WS_POPUP
Different styles for main window include:
Normal window: WS_OVERLAPPED
, shown with ShowWindow(hwnd, SW_SHOW)
Maximized window: WS_OVERLAPPED
, shown with ShowWindow(hwnd, SW_MAXMIZE)
covers the whole screen, not including the taskbar
Fullscreen: WS_POPUP
flag, with width & height set to SM_CXSCREEN
/SM_CYSCREEN
, covers the whole screen, it goes over the task bar
All these windows can have WS_BORDER
or not. Or they may have WS_THICKFRAME
for resizing border. In fullscreen mode, the window usually has no border. In maximized mode, the borders fall outside the view area.
More details: Window Styles