title image


Smiley Re: Liste mit allen möglichen Bildschirmauflösungen...
Hallo !Hier der Code :Auf der Form volgende Objekte : List1 & Command1Const CCHDEVICENAME = 32Const CCHFORMNAME = 32Private Type DEVMODE dmDeviceName As String * CCHDEVICENAME 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 * CCHFORMNAME dmUnusedPadding As Integer dmBitsPerPel As Integer dmPelsWidth As Long dmPelsHeight As Long dmDisplayFlags As Long dmDisplayFrequency As LongEnd TypeConst DM_BITSPERPEL = &H40000Const DM_PELSWIDTH = &H80000Const DM_PELSHEIGHT = &H100000Private Declare Function ChangeDisplaySettings Lib "user32" Alias "ChangeDisplaySettingsA" (lpInitData As DEVMODE, ByVal dwFlags As Long) As LongPrivate Declare Function EnumDisplaySettings Lib "user32" Alias "EnumDisplaySettingsA" (ByVal lpszDeviceName As Long, ByVal iModeNum As Long, lpDevMode As DEVMODE) As LongPrivate Declare Function ExitWindowsEx Lib "user32" (ByVal uFlags As Long, ByVal dwReserved As Long) As Long' /* Flags for ChangeDisplaySettings */Const CDS_UPDATEREGISTRY = &H1Const CDS_TEST = &H2Const CDS_FULLSCREEN = &H4Const CDS_GLOBAL = &H8Const CDS_SET_PRIMARY = &H10Const CDS_RESET = &H40000000Const CDS_SETRECT = &H20000000Const CDS_NORESET = &H10000000' /* Return values for ChangeDisplaySettings */Const DISP_CHANGE_SUCCESSFUL = 0Const DISP_CHANGE_RESTART = 1Const DISP_CHANGE_FAILED = -1Const DISP_CHANGE_BADMODE = -2Const DISP_CHANGE_NOTUPDATED = -3Const DISP_CHANGE_BADFLAGS = -4Const DISP_CHANGE_BADPARAM = -5Const EWX_LOGOFF = 0Const EWX_SHUTDOWN = 1Const EWX_REBOOT = 2Const EWX_FORCE = 4Dim D() As DEVMODE, lNumModes As LongPrivate Sub Command1_Click() Dim l As Long, Flags As Long, x As Long x = List1.ListIndex + 1 D(x).dmFields = DM_BITSPERPEL Or DM_PELSWIDTH Or DM_PELSHEIGHT Flags = CDS_UPDATEREGISTRY l = ChangeDisplaySettings(D(x), Flags) Select Case l Case DISP_CHANGE_RESTART l = MsgBox("You must reboot for the change to take effect.", vbOKCancel) If l = vbOK Then Flags = 0 l = ExitWindowsEx(EWX_REBOOT, Flags) End If Case DISP_CHANGE_SUCCESSFUL Case Else MsgBox "Error changing resolution!" End SelectEnd SubPrivate Sub Form_Load() Dim l As Long, lMaxModes As Long lMaxModes = 8 ReDim D(0 To lMaxModes) As DEVMODE lNumModes = 0 l = EnumDisplaySettings(0, lNumModes, D(lNumModes)) Do lNumModes = lNumModes + 1 If lNumModes > lMaxModes Then lMaxModes = lMaxModes + 8 ReDim Preserve D(0 To lMaxModes) As DEVMODE End If l = EnumDisplaySettings(0, lNumModes, D(lNumModes)) If l = 0 Then Exit Do List1.AddItem D(lNumModes).dmPelsWidth & "x" & D(lNumModes).dmPelsHeight & "x" & D(lNumModes).dmBitsPerPel Loop lNumModes = lNumModes - 1End Sub

geschrieben von

Login

E-Mail:
  

Passwort:
  

Beitrag anfügen

Symbol:
 
 
 
 
 
 
 
 
 
 
 
 
 

Überschrift: