Refresh Rate

Hi there,

Im the programmer of NVmax and i’m looking for some way to force a certain refresh rate in OpenGL. At the moment this can be done in DirectX using DXdialog however I can find no reg key for OpenGL refresh force.

Any help to but be greatly appriechiated,

Thanks for your time.


^ ?

Set your displayfrequency in the dmDisplayFrequency member of the DEVMODE structure you pass to ChangeDisplaySettings. Also, don’t forget to add DM_DISPLAYFREQUENCY to dmFields.

This will only change the refresh rate of Windows, as far as I understand OpenGL defaults to 60Hz in all resolutions like DirectX unless forced via a reg key.

Can I also ask since you are knowledgeable on the ChangeDisplaySettings function why it wont return refresh rates in 9x/me.

Here is my code

Private Type DEVMODE
dmDeviceName As String * CCDEVICENAME
dmSpecVersion As Integer
dmDriverVersion As Integer
dmSize As Integer
dmDriverExtra As Integer
dmFields As Long
dmOrientation As Integer
dmPaperSize As Integer
dmPaperLength As Integer
dmPaperWidth As Integer
dmScale As Integer
dmCopies As Integer
dmDefaultSource As Integer
dmPrintQuality As Integer
dmColor As Integer
dmDuplex As Integer
dmYResolution As Integer
dmTTOption As Integer
dmCollate As Integer
dmFormName As String * CCFORMNAME
dmUnusedPadding As Integer
dmBitsPerPel As Long
dmPelsWidth As Long
dmPelsHeight As Long
dmDisplayFlags As Long
dmDisplayFrequency As Long
End Type

Public Function enumscreenhz()
On Error Resume Next
Dim lindex As Integer
Dim tDevMode As DEVMODE
lindex = 0

If EnumDisplaySettings(displayn, lindex, tDevMode) = 0 Then: Exit Do
lindex = lindex + 1

If Val(tDevMode.dmPelsWidth) & " by " & Val(tDevMode.dmPelsHeight) = nv.display(0).Text Then
If tDevMode.dmBitsPerPel & " Bits" = nv.display(1).Text Then
nv.display(2).AddItem tDevMode.dmDisplayFrequency & " Hertz"
End If
End If

End Function

In summary the user selects the resolution and color depth to use (which are enumerated fine in 9x/2000) and the code enumerates all the refresh rates found that have that resolution and color depth and adds them to the list box.

Whilst this works fine in 2000/XP it always returns 0 in 9x/me, and to this day I can not find out why?

Thanks for your time,