How do I make a fullscreen application with DevC++ without using OpenGL or GLUT or DirectX?
Thanks, August.
How do I make a fullscreen application with DevC++ without using OpenGL or GLUT or DirectX?
Thanks, August.
This works:
Position your window at (0, 0) and make it WIDTH wide and HEIGHT high so it covers the entire screen.Code:DEVMODE screen; screen.dmBitsPerPel = 32; screen.dmPelsWidth = WIDTH; screen.dmPelsHeight = HEIGHT; screen.dmFields = DM_BITSPERPEL | DM_PELSWIDTH | DM_PELSHEIGHT; if(ChangeDisplaySettings(&screen, CDS_FULLSCREEN) != DISP_CHANGE_SUCCESSFUL) { // Fullscreen failed return 0; }
I changed it to this:
But it failed! How come?Code:DEVMODE screen; screen.dmBitsPerPel = 32; screen.dmPelsWidth = GetSystemMetrics(SM_CYSCREEN); screen.dmPelsHeight = GetSystemMetrics(SM_CXSCREEN); screen.dmFields = DM_BITSPERPEL | DM_PELSWIDTH | DM_PELSHEIGHT; if(ChangeDisplaySettings(&screen, CDS_FULLSCREEN) != DISP_CHANGE_SUCCESSFUL) { // Fullscreen failed return 0; }
If all you need to do is set your window dimensions to the same as your current desktop then just use GetSystemMetrics to get the desktop width and height and use these to create your window (or use SetWindowPos or MoveWindow after window creation).How do I make a fullscreen application with DevC++ without using OpenGL or GLUT or DirectX?
If you are using ChangeDisplaySettings then its probably best to use EnumDisplaySettings first to fill out a viable DEVMODE struct for your target machine.
CProgramming FAQ
Caution: this person may be a carrier of the misinformation virus.
You've switched width and height values.Originally Posted by Cool-August
I don't get it I swiched the width and height values, now it goes fullscreen black. Then t goes back to a window.
I am getting confused. So could you just tell me how to get rid of the title bar on a window?
I just tried Ken's solution and that works just as fine (or better, since you need less code), so you don't need to use ChangeDisplaySettings. Just use WS_POPUP as your window style, and set the width and height of your window to the width and height of the screen:
Code:HWND window = CreateWindow( TEXT("Class"), NULL, // WS_POPUP has no title bar WS_POPUP, // No title bar or border 0, 0, // Position the window at the topleft GetSystemMetrics(SM_CXSCREEN), GetSystemMetrics(SM_CYSCREEN), NULL, NULL, hInstance, NULL);