Archived

This topic is now archived and is closed to further replies.

chasin

Change screensize (fullscreen)

Recommended Posts

well this is a very basic function to do it (it lacks error-handling, but it wasnt needed in this program anyway)


/*

Function: SetRes()

Alters the desktop resolution to width*height,
The mode will automatically restore once the program shuts down

*/
void __fastcall TMainform::SetRes(int width, int height)
{
DEVMODE dmScreenSettings; // Device Mode
memset(&dmScreenSettings,0,sizeof(dmScreenSettings)); // Makes Sure Memory''s Cleared

dmScreenSettings.dmSize=sizeof(dmScreenSettings); // Size Of The Devmode Structure
dmScreenSettings.dmPelsWidth = width; // Selected Screen Width
dmScreenSettings.dmPelsHeight = height; // Selected Screen Height
dmScreenSettings.dmBitsPerPel = 32; // Selected Bits Per Pixel

dmScreenSettings.dmFields=DM_BITSPERPEL|DM_PELSWIDTH|DM_PELSHEIGHT;

ChangeDisplaySettings(&dmScreenSettings,CDS_FULLSCREEN);
}

Share this post


Link to post
Share on other sites