Page 1 of 1

Change refresh rate ONLY

Posted: 20 Oct 2019, 13:47
by whitestar127
Hi, I was wondering if it's possible to change refresh rate without doing anything with the resolution. In other words, is it possible to get to this windows function: Display Settings -> Advanced Display Settings -> Display adapter properties for Display x -> Monitor and then change Screen refresh rate programmatically (without opening any of the windows obviously)?

I am already using this code now (which I found by searching) to change my refresh rate to 60 Hz on a bezel corrected surround setup:

Code: Select all

ChangeResolution( cD, sW, sH, rR ) {
  VarSetCapacity(dM,156,0), NumPut(156,2,&dM,36)
  DllCall( "EnumDisplaySettingsA", UInt,0, UInt,-1, UInt,&dM ), 
  NumPut(cD,dM,104), NumPut(sW,dM,108), NumPut(sH,dM,112), NumPut(rR,dM,120)
  Return DllCall( "ChangeDisplaySettingsA", UInt,&dM, UInt,0 )
But I was wondering if it's possible to JUST change the refresh rate without involving any of the pixel and color depth parameters.

Any help will be greatly appreciated :)

Re: Change refresh rate ONLY

Posted: 23 Oct 2019, 05:02
by whitestar127
I found this amazing program that made everything really easy:

Insert :// after http to make the link work.

Re: Change refresh rate ONLY

Posted: 23 Oct 2019, 11:01
by just me
Might do it:

Code: Select all

ChangeDisplayFrequency(Frequency) {
   VarSetCapacity(DEVMODE, 156, 0)
   NumPut(156, DEVMODE, 36, "UShort")
   DllCall("EnumDisplaySettingsA", "Ptr", 0, "UInt", -1, "Ptr", &DEVMODE)
   NumPut(0x400000, DEVMODE, 40)
   NumPut(Frequency, DEVMODE, 120, "UInt")
   Return DllCall("ChangeDisplaySettingsA", "Ptr", &DEVMODE, "UInt", 0)