Advertisement

Full Screen Program in C

Started by December 30, 2002 01:15 PM
8 comments, last by Sp4hn 21 years, 10 months ago
I just started using C and I am wondering how do I make my program take up the whole screen?

What OS do U use. Are U trying to make a fullscreen program in DOs or Windows? And What do you use? Borland C or Dev C or maybe VC++?
Advertisement
If you''re trying to do this in program in DOS, it should automatically goto full screen. If you''re programming in Windows, I have no idea what you''re suposed to do.
If you''re making it for Windows, I don''t think that there is a way of doing it from within your actual program, because it is dependent on a user setting. The only way I can think of doing this would be to execute the program from another program using ShellExecute (or ShellExec, can''t remember) function found in the windows.h function. You can pass different arguments which determine how the program opens. For example, you can do stuff like SW_FULLSCREEN ... or something like that ... have a search for ShellExecute (or ShellExec ) at the MSDN site. Good luck :D

:::: Lektrix ::::
[ Google || ACCU || BarrysWorld || E-Mail Me ]
[ Google || Start Here || ACCU || STL || Boost || MSDN || GotW || CUJ || MSVC++ Library Fixes || BarrysWorld || [email=lektrix@barrysworld.com]E-Mail Me[/email] ]
I think when you call ShowWindow() after all the creation stuff, you can specify SW_SHOWMAXIMIZED as the show state. That is a maximized window, if you want a fullscreen window like a game take a look at nehe''s tutorials.
I hope that helps.
just fyi, for the Windows-related discussion, you can also use the WS_MAXIMIZE style in your CreateWindow call to get a window that''s initially maximized.
Advertisement
In case you hadn''t guessed, we need more information

Is your program a console app (text-only, in a DOS box), or a Win32 app (uses a dialog box or normal window)?

Are you using a graphics API like DirectX or OpenGL?

Richard "Superpig" Fine - saving pigs from untimely fates - Microsoft DirectX MVP 2006/2007/2008/2009
"Shaders are not meant to do everything. Of course you can try to use it for everything, but it's like playing football using cabbage." - MickeyMouse

there actually is an easy way to change screen resolution and windowed/fullscreen mode at runtime.
just create your window class with WS_POPUP attribute and use this code to switch to fullscreen:


    bool EnterFullscreen (){	DEVMODE newSettings;		// now fill the DEVMODE with standard settings, mainly monitor frequenzy	EnumDisplaySettings ( NULL, 0, &newSettings );	//  set desired screen size/res	 	newSettings.dmPelsWidth  = 800;			newSettings.dmPelsHeight = 600;			newSettings.dmBitsPerPel = 16;					//set those flags to let the next function know what we want to change 	newSettings.dmFields = DM_BITSPERPEL | DM_PELSWIDTH | DM_PELSHEIGHT;	// and apply the new settings	if ( ChangeDisplaySettings ( &newSettings, CDS_FULLSCREEN ) 		!= DISP_CHANGE_SUCCESSFUL )	return false; // in case of error	else return true;}// and to reset the screen  on program exit:void ResetScreen (){	// this resets the screen to the registry-stored values  	ChangeDisplaySettings ( NULL, 0 );}    



Runicsoft -- home of my open source Function Parser and more

[edited by - Burning_Ice on December 31, 2002 6:39:37 AM]
you would have to set it up for like 800 x 600 the give the user the option in the settings panel to up the res to 1024 x 768 or above.
have i been deleted from the board?

This topic is closed to new replies.

Advertisement