Hello
exists a simple code to change the monitor frequency to 120 Hz to 60 Hz or inverse ?
Simple code to change the monitor frequency
Re: Simple code to change the monitor frequency
For Windows, start reading here (and the posts after it) -> https://www.purebasic.fr/english/viewto ... 54#p159754
Re: Simple code to change the monitor frequency
On Windows u can give this a try (untested):
Imho. changing the Frequency of the Montor is not a good idea.
According to some posts it could even damaged the Monitor!
About the API: https://docs.microsoft.com/en-us/window ... ysettingsa
Just noticed that BarryG already answered
Code: Select all
Procedure.i SetMonitorFrequency(Value.i)
Protected dv.DEVMODE
Protected state.i
dv\dmDisplayFrequency = Value
dv\dmFields = #DM_DISPLAYFREQUENCY
dv\dmSize = SizeOf(DEVMODE)
state = ChangeDisplaySettings_(@dv,#Null)
If state = #DISP_CHANGE_SUCCESSFUL
ProcedureReturn 1
ElseIf state = #DISP_CHANGE_RESTART;changed after restart!
ProcedureReturn 2
EndIf
ProcedureReturn #Null
EndProcedure
According to some posts it could even damaged the Monitor!
About the API: https://docs.microsoft.com/en-us/window ... ysettingsa
Just noticed that BarryG already answered
Re: Simple code to change the monitor frequency
a very primitive and brutal way....but it is still a beginning..
Code: Select all
; www.purearea.net (Sourcecode collection by cnesm)
; Author: Andreas
; Date: 22. November 2003
;#############################
;Author : Andreas
;16.06.2003
;#############################
;--- Modified by Simo
NewList Display.DEVMODE()
EnumDisplaySettings_(0,x,dev.DEVMODE)
Debug dev\dmDisplayFrequency
End
Re: Simple code to change the monitor frequency
Code: Select all
;/ Initialize PureBasic desktop library
ExamineDesktops()
;/ Iterate through supported display settings and display only select criteria
While EnumDisplaySettings_(0,i,@DevMode.DEVMODE)
If DesktopWidth(0)*1.0/DesktopHeight(0)=DevMode\dmPelsWidth*1.0/DevMode\dmPelsHeight
Debug Str(DevMode\dmPelsWidth)+" "+Str(DevMode\dmPelsHeight)+" "+Str(DevMode\dmDisplayFrequency)
EndIf
i+1
Wend
but
can't figure out how to locate a second monitor, DesktopWidth(0) or DesktopWidth(1) doesn't change anything...
Re: Simple code to change the monitor frequency
You forgot to select the actual Desktop/Device - change:
If you want to use API select the Desktop/Device with:
And change the Frequency with:
Code: Select all
DesktopWidth(0) -> DesktopWidth(i)
Code: Select all
EnumDisplayDevices_()
Code: Select all
ChangeDisplaySettingsEx_()