Can some one specify the windows API, one need to use in order to be able to change programmatically the screen refresh rate?
+1
A:
I found this via a google search. Hope it helps some.
http://www.codeproject.com/KB/winsdk/changerefresh.aspx
http://msdn.microsoft.com/en-us/library/ms533260(VS.85).aspx
Ólafur Waage
2008-09-28 18:54:43
+1
A:
you can use ChangeDisplaySettings as described before. But you should use EnumDisplaySettings to get a list of valid combinations of (color dept, width, height, mode and frequency).
Sample code (in Delphi but translation should be trivial)
Get valid display modes
i := 0;
while EnumDisplaySettings(nil, i, dm) do begin
Memo1.Lines.Add(Format('Color Depth: %d', [dm.dmBitsPerPel]));
Memo1.Lines.Add(Format('Resolution: %d, %d', [dm.dmPelsWidth, dm.dmPelsHeight]));
Memo1.Lines.Add(Format('Display mode: %d', [dm.dmDisplayFlags]));
Memo1.Lines.Add(Format('Frequency: %d', [dm.dmDisplayFrequency]));
Inc(i);
end;
Set display mode
// In this case i is an index in the list of valid display modes.
if EnumDisplaySettings(nil, i, dm) then begin
// Sanity check!
if ChangeDisplaySettings(dm, CDS_TEST) = 0) then
ChangeDisplaySettings(dm, 0); // Use CDS_UPDATEREGISTRY if this is the new default mode.
end;
It is very important to chose a valid combination!
Gamecat
2008-09-28 19:09:32
Delphi is one of my favorites:)
ArielBH
2008-09-28 19:50:23