Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to change screen resolution in release mode?

Status
Not open for further replies.

mirr2001

Programmer
Mar 29, 2002
24
DK
I have written a small program, which changes the screen resolution from 1024*768 @ 70Hz to 800*600 @ 60Hz and back, to play a video in 800*600 res. And the program works fine so far; but only in Debug mode. If I change settings to Release mode, the resolution does not change to 800*600. But later on, when called, it tries to "switch back" to 1024*768. Does anyone know how to solve this Problem? (here are the codes:)

void CTvdiagDlg::OnMin()
{
LPDEVMODE lpDev=new DEVMODE;
lpDev->dmFields=DM_PELSWIDTH | DM_PELSHEIGHT | DM_DISPLAYFREQUENCY;

lpDev->dmPelsHeight=600;
lpDev->dmPelsWidth=800;
lpDev->dmDisplayFrequency= 60;

if(ChangeDisplaySettings(lpDev, CDS_UPDATEREGISTRY)!=DISP_CHANGE_SUCCESSFUL)

{
MessageBox("error changing resolution");
}
delete lpDev;
lpDev=NULL;
}

void CTvdiagDlg::OnMax()
{
LPDEVMODE lpDev=new DEVMODE;
lpDev->dmFields=DM_PELSWIDTH | DM_PELSHEIGHT | DM_DISPLAYFREQUENCY;


lpDev->dmPelsHeight=768;
lpDev->dmPelsWidth=1024;
lpDev->dmDisplayFrequency= 70;


if(ChangeDisplaySettings(lpDev, CDS_UPDATEREGISTRY)!=DISP_CHANGE_SUCCESSFUL)
{
MessageBox("error changing resolution");
}
delete lpDev;
lpDev=NULL;
}
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top