如何更改螢幕顯示頻率(Frequency)?

如何更改螢幕顯示頻率(Frequency)?

如何使用程式更改顯示器更新頻率

' 列舉顯示器設定
Private Declare Function EnumDisplaySettings Lib "user32" Alias "EnumDisplaySettingsA" _
    (ByVal lpszDeviceName As Long, ByVal iModeNum As Long, lpDevMode As Any) As Long

' 改變顯示器設定
Private Declare Function ChangeDisplaySettings Lib "user32" Alias "ChangeDisplaySettingsA" _
    (lpDevMode As Any, ByVal dwflags As Long) As Long

' 自定型態 (結構)
Private Type DevMode
    dmDeviceName As String * 32
    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 * 32
    dmUnusedPadding As Integer
    dmBitsPerPel As Integer
    dmPelsWidth As Long
    dmPelsHeight As Long
    dmDisplayFlags As Long
    dmDisplayFrequency As Long
End Type

Private Sub cmd設定_Click()

    Dim DevX As DevMode ' Device Mode

    EnumDisplaySettings 0, 0, DevX '
列舉顯示器設定

    ' 設定更改顯示器頻率攔位
    DevX.dmFields = &H400000 ' DM_DISPLAYFREQUENCY

    DevX.dmDisplayFrequency = 75 '
設定螢幕更新頻率 xx KHz

    ChangeDisplaySettings DevX, 1 '
改變設定

End Sub