Private Declare Function GetDeviceCaps Lib "gdi
Private Declare Function ChangeDisplaySettings Lib "user
Private Const CCDEVICENAME As Long =
Private Const CCFORMNAME As Long =
Private Const DM_BITSPERPEL As Long = &H
Private Const DM_PELSWIDTH As Long = &H
Private Const DM_PELSHEIGHT As Long = &H
Private Const DM_DISPLAYFLAGS As Long = &H
Private Const DM_DISPLAYFREQUENCY = &H
Private Const CDS_FORCE As Long = &H
Private Const BITSPIXEL As Long =
Private Const HORZRES As Long =
Private Const VERTRES As Long =
Private Const VREFRESH =
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 Integer
dmPelsWidth As Long
dmPelsHeight As Long
dmDisplayFlags As Long
dmDisplayFrequency As Long
End Type
Private Sub cmdChangeDesktopMode_Click()
Dim DM As DEVMODE
With DM
End With
If ChangeDisplaySettings(DM
MsgBox "錯誤!不支持此模式!"
End If
End Sub
Private Sub Form_Load()
txtOldWidth
txtOldHeight
txtOldColor
txtOldFreq
End Sub
From:http://tw.wingwit.com/Article/program/net/201311/14378.html