Click to See Complete Forum and Search --> : screen resolution


dave2k
January 27th, 2006, 07:02 AM
can anyone tell me the api methods for getting and setting screen sresolution?

cheers

kkez
January 27th, 2006, 07:42 AM
Please do a search in the forum, this question has been answered many times :)

dave2k
January 27th, 2006, 09:48 AM
oh yeh sorry

for anyone who is searching in the future, here is my code for switching between 2 popular resolutions: DEVMODE dm;
EnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS, &dm);
dm.dmPelsWidth = dm.dmPelsWidth == 1280 ? 1024 : 1280;
dm.dmPelsHeight = dm.dmPelsHeight == 1024 ? 768 : 1024;
dm.dmFields = DM_PELSWIDTH | DM_PELSHEIGHT | DM_DISPLAYFREQUENCY | DM_BITSPERPEL;
ChangeDisplaySettings(&dm, 0);

golanshahar
January 27th, 2006, 11:58 AM
or you can do it like this:

int nWidth =::GetSystemMetrics(SM_CXSCREEN);
int nHeight =::GetSystemMetrics(SM_CYSCREEN);


Cheers