Get resolution
int m_nwindwmetricsx = :: GetSystemMetrics (sm_ Cxscreen);
int m_nwindwmetricsy = : : GetSystemMetrics (Sm_cyscreen);
//Modify resolution
DEVMODE Lpdevmode;
lpdevmode.dmbitsperpel=32;
lpdevmode.dmpelswidth=1024;
lpdevmode.dmpelsheight=768;
Lpdevmode.dmsize=sizeof (Lpdevmode);
Lpdevmode.dmfields =dm_pelswidth| Dm_pelsheight| Dm_bitsperpel;
LONG result;
Result=changedisplaysettings (&lpdevmode,0);
if (result==disp_change_successful)
{
AfxMessageBox (L "modified successfully!" );
changedisplaysettings (&lpdevmode,cds_updateregistry);
/ / use Cds_updateregistry to indicate that minor modifications are Long-lasting,
/ / and write the relevant data in the registry
}
Else
{
AfxMessageBox (L "Modify failed, restore original settings!" );
changedisplaysettings (null,0 );
}
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
VC gets and modifies the computer screen resolution