How to create fullscreen window without title bar
How to create fullscreen window without title bar
The use of WS_POPUP | WS_MAXIMIZEBOX sets the
window properties and allowing us to create fullscreen window without title
bar.
Note that GetSystemMetrics() with SM_CXSCREEN
returns the screen resolution of the primary monitor.
HWND CVideoWindow::InitInstance(LPCWSTR windowName, int width, int height)
{
int x = ::GetSystemMetrics(SM_CXSCREEN) / 2 - width / 2;
int y = ::GetSystemMetrics(SM_CYSCREEN) / 2 - height / 2;
m_hWnd = CreateWindow(L"MyWindow", windowName, WS_POPUP | WS_MAXIMIZEBOX, x, y, width, height, NULL, NULL, NULL, NULL);
return m_hWnd;
}

1 Comments:
The above code on some windows config only shows zoom-in results depending on local GPU driver scaling setup. On windows 7 platform, if using windows 7 basic, not windows classic, can use the following code to enable fullscreen mode without title bar, without scaling.
m_hWnd = CreateWindowEx(0, L"MyWindow", 0, WS_VISIBLE | WS_SYSMENU | WS_THICKFRAME, 0, 0, width, height, NULL, NULL, NULL, NULL);
SetWindowLong(m_hWnd, GWL_STYLE, 0);
Post a Comment
<< Home