#include <windows.h>
#include <stdio.h>
#include <conio.h>
void main()
{
DEVMODE devmode,oldmode;
EnumDisplaySettings(NULL,ENUM_CURRENT_SETTINGS,&devmode);
ZeroMemory(&oldmode,sizeof(DEVMODE));
CopyMemory(&oldmode,&devmode,sizeof(DEVMODE));
printf("BitsPerPel:%d\n",devmode.dmBitsPerPel);
printf("DisplayFrequency:%d\n",devmode.dmDisplayFrequency);
printf("PelsWidth:%d\n",devmode.dmPelsWidth);
printf("PelsHeight:%d\n",devmode.dmPelsHeight);
printf("Press any key to change display...\n");
getch();
printf("BitsPerPel:%d\n",devmode.dmBitsPerPel=16);
printf("DisplayFrequency:%d\n",devmode.dmDisplayFrequency=60);
printf("PelsWidth:%d\n",devmode.dmPelsWidth=800);
printf("PelsHeight:%d\n",devmode.dmPelsHeight=600);
ChangeDisplaySettings(&devmode,0);
printf("Press any key to restore...\n");
getch();
printf("BitsPerPel:%d\n",oldmode.dmBitsPerPel);
printf("DisplayFrequency:%d\n",oldmode.dmDisplayFrequency);
printf("PelsWidth:%d\n",oldmode.dmPelsWidth);
printf("PelsHeight:%d\n",oldmode.dmPelsHeight);
printf("Press any key to change display...\n");
ChangeDisplaySettings(&oldmode,0);
getch();
}