65.9K
CodeProject is changing. Read more.
Home

Changing your monitor's refresh rate

starIconstarIconstarIconstarIconstarIcon

5.00/5 (2 votes)

May 23, 2000

viewsIcon

118593

This article will show you how to change your monitor's refresh rate to a value not available from control panel.

Changing Your Monitor's Refresh Rate

I have an older Sony Trinitron monitor, made approximately in 1992. It's a 20" monitor that supports a resolution of 1024x768. However, whenever I set it to that resolution via Control Panel, the screen image was distored and horribly bowed. I found, on a NT machine, the only way it worked properly was when the refresh rate was set to 70MHz (a resolution of 800x600 required 72MHz, and I wasn't even interested in 640x480). The problem was the machine I wanted to use it on was running Win98, and the only available refresh rates were 65MHz, 75MHz, and 85MHz. A while later I stumbled upon an Win32 function called ChangeDisplaySettings(). The below code snippet shows how to use it to change the refresh rate:

   DEVMODE devMode;
   ::ZeroMemory(&devMode, sizeof(devMode));
   devMode.dmDisplayFrequency = 70;
   devMode.dmFields = DM_DISPLAYFREQUENCY;
   devMode.dmSize = sizeof(devMode);
   ChangeDisplaySettings(&devMode, 0);

I created a console application that gets launched at startup which executes the above code. Initially, when Windows starts up, the screen image is distored, but once the program launches I have perfect 1024x768 resolution. So before you get rid of that monitor you just can't seem to adjust, give the above code a try.