用VB改变屏幕的分辨率和刷新频率

2018-06-17 17:14:56来源:未知 阅读 ()

新老客户大回馈,云服务器低至5折

OptionExplicit

PublicDeclareFunctionChangeDisplaySettingsLib"user32.dll"Alias"ChangeDisplaySettingsA"

(ByReflpDevModeAsDEVMODE,ByValdwFlagsAsLong)AsLong
PublicDeclareFunctionEnumDisplaySettingsLib"user32.dll"Alias"EnumDisplaySettingsA"(ByVal

lpszDeviceNameAsString,ByValiModeNumAsLong,ByReflpDevModeAsDEVMODE)AsLong

ConstDM_PELSHEIGHTAsLong=&H100000
ConstDM_PELSWIDTHAsLong=&H80000
ConstDM_BITSPERPELAsLong=&H40000
ConstDM_DISPLAYFREQUENCYAsLong=&H400000

ConstCCHDEVICENAMEAsLong=32
ConstCCHFORMNAMEAsLong=32
ConstCDS_TEST=&H4

PrivateTypeDEVMODE
dmDeviceNameAsString*CCHDEVICENAME
dmSpecVersionAsInteger
dmDriverVersionAsInteger
dmSizeAsInteger
dmDriverExtraAsInteger
dmFieldsAsLong
dmOrientationAsInteger
dmPaperSizeAsInteger
dmPaperLengthAsInteger
dmPaperWidthAsInteger
dmScaleAsInteger
dmCopiesAsInteger
dmDefaultSourceAsInteger
dmPrintQualityAsInteger
dmColorAsInteger
dmDuplexAsInteger
dmYResolutionAsInteger
dmTTOptionAsInteger
dmCollateAsInteger
dmFormNameAsString*CCHFORMNAME
dmUnusedPaddingAsInteger
dmBitsPerPelAsInteger
dmPelsWidthAsLong
dmPelsHeightAsLong
dmDisplayFlagsAsLong
dmDisplayFrequencyAsLong
EndType

'-------------------------------------------------------------------------------------------
'LngWidth//屏幕的宽(单位象素)
'LngHeight//屏幕的高(单位象素)
'IntColor//多少位颜色(e.g16or32)
'LngFrequency//屏幕的刷新频率
'
'声明:
'调用该函数时要确定所设置的值在系统所允许的设置范围内,比如系统的最大刷新频率位80,而你
'用把LngFrequency设位85,这样将带来无法预测的后果。
'------------------------------------------------------------------------------------------
PublicFunctionSetDisplaymode(LngWidthAsLong,LngHeightAsLong,IntColorAsInteger,

LngFrequencyAsLong)AsLong
DimNewDevmodeAsDEVMODE
DimlngPAsLong

'obtainsinformation
EnumDisplaySettings0&,0&,NewDevmode

WithNewDevmode
.dmFields=DM_PELSHEIGHTOrDM_PELSWIDTHOrDM_BITSPERPELOrDM_DISPLAYFREQUENCY
.dmPelsWidth=LngWidth
.dmPelsHeight=LngHeight
.dmBitsPerPel=IntColor
.dmDisplayFrequency=LngFrequency
EndWith

SetDisplaymode=ChangeDisplaySettings(NewDevmode,CDS_TEST)
EndFunction

->

标签:

版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com
特别注意:本站所有转载文章言论不代表本站观点,本站所提供的摄影照片,插画,设计作品,如需使用,请与原作者联系,版权归原作者所有

上一篇:复本操作的对象、属性和方法(3)--网络数据库的复制和同步(4)

下一篇:计算字符串长度(关于日文字符)