Change the resolution and refresh frequency of the screen in VB6! ! !

zhaozj2021-02-16  99

Option expedition

Public Declare Function ChangeDisplaySettings Lib "user32.dll" Alias ​​"ChangeDisplaySettingsA" (ByRef lpDevMode As DEVMODE, ByVal dwFlags As Long) As LongPublic Declare Function EnumDisplaySettings Lib "user32.dll" Alias ​​"EnumDisplaySettingsA" (ByVal lpszDeviceName As String, ByVal iModeNum As Long , Byref lpdevmode as devmode) As long

Const DM_PELSHEIGHT As long = & h100000 const DM_PELSWIDTH AS long = & h80000 const DM_BITSPERPEL AS long = & h40000 const DM_DISPLAYFREQUENCY As long = & h400000

Const cchdevicename as long = 32 const cchFormName as long = 32 const cds_test = & h4

Private 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 Type '------------- -------------------------------------------------- -------------------------- 'LNGWidth // screens wide (unit pixels)' lngheight // screen high (single icon ) 'INTCOLOR // How many color (EG 16 or 32)' LNGFREQUENCY / / screen refresh frequency '' declaration: 'When calling the function, make sure that the set value is within the settings allowed by the system, For example, the system's maximum refresh frequency bit 80, and you 'use the lngfrequency setting 85, which will bring the consequences that cannot be predicted.

转载请注明原文地址:https://www.9cbs.com/read-11428.html

New Post(0)