Public Declare Function changedisplaysettings Lib "user32.dll" Alias "Changedisplaysettingsa" (ByRef Lpdevmode as DEVMODE , ByVal dwflags as long) as long
Public 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 Long
End Type
'-------------------------------------------------------------------------------------------
' Lngwidth//Screen width (unit pixel)
' Lngheight//Screen height (per pixel)
' Intcolor//number of bits of color (e.g or 32)
' Lngfrequency//Screen refresh rate
'
Statement
' Call this function to determine that the value you set is within the system's allowable settings, such as the system's maximum refresh rate of 80, and you
' Use the lngfrequency to set a bit 85, which can have unpredictable consequences.
'------------------------------------------------------------------------------------------
Public Function Setdisplaymode (lngwidth as Long, lngheight as Long, intcolor as Integer, lngfrequency as long) as long
Dim Newdevmode as DEVMODE
Dim LNGP as Long
' Obtains information
EnumDisplaySettings 0&, 0&, Newdevmode
With Newdevmode
. dmfields = Dm_pelsheight or Dm_pelswidth or Dm_bitsperpel or dm_displayfrequency
. Dmpelswidth = Lngwidth
. Dmpelsheight = Lngheight
. Dmbitsperpel = Intcolor
. dmdisplayfrequency = Lngfrequency
End With
Setdisplaymode = ChangeDisplaySettings (Newdevmode, Cds_test)
End Function
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.