Re: Change resolution
Change resolution to 800x600
HDC hdc = GetDC(NULL); // Screen DC used to get
// current display
// settings
DEVMODE DisplayMode;
ZeroMemory(&DisplayMode, sizeof(DEVMODE));
DisplayMode.dmSize = sizeof(DEVMODE);
DisplayMode.dmDriverExtra = 0;
DisplayMode.dmFields = DM_BITSPERPEL | DM_PELSWIDTH | DM_PELSHEIGHT;
DisplayMode.dmPelsWidth = GetDeviceCaps(hdc,HORZRES);
DisplayMode.dmPelsHeight = GetDeviceCaps(hdc,VERTRES);
DisplayMode.dmBitsPerPel = GetDeviceCaps(hdc,BITSPIXEL);
ReleaseDC(NULL, hdc);
DisplayMode.dmPelsWidth = 640;
DisplayMode.dmPelsHeight = 480;
if (DisplayMode.dmBitsPerPel < 16)
{
DisplayMode.dmBitsPerPel = 16;
}
//CDS_FULLSCREEN will keep all the windows in their current state
//so that they can be restored after we are done.
ChangeDisplaySettings(&DisplayMode,CDS_FULLSCREEN);
change it back to what it was before.
ChangeDisplaySettings(NULL,CDS_FULLSCREEN);
AliR.
"Ovidiu Blejdea" <blejdea.ovidiu@gmail.com> wrote in message
news:ek%23S9NCYHHA.4232@TK2MSFTNGP05.phx.gbl...
I want to start coding a game in MFC, so I want to make my Window
maximized, and I want to be able to change resolution. The problem is that
I don't know how to change the resolution. Can somebody help me with that.
Thank you in advance!