PublicFunctionSetDisplayMode(WidthAs_
Integer,HeightAsInteger,ColorAs_
Integer)AsLong
ConstDM_PELSWIDTH=&H80000
ConstDM_PELSHEIGHT=&H100000
ConstDM_BITSPERPEL=&H40000
DimNewDevModeAsDEVMODE
DimpDevmodeAsLong
WithNewDevMode
.dmSize=122
IfColor=-1Then
.dmFields=DM_PELSWIDTHOrDM_PELSHEIGHT
Else
.dmFields=DM_PELSWIDTHOr_
DM_PELSHEIGHTOrDM_BITSPERPEL
EndIf
.dmPelsWidth=Width
.dmPelsHeight=Height
IfColor<>-1Then
.dmBitsPerPel=Color
EndIf
EndWith
pDevmode=lstrcpy(NewDevMode,NewDevMode)
SetDisplayMode=ChangeDisplaySettings(pDevmode,0)
EndFunction
例子调用:改变为640x480x24位:
i=SetDisplayMode(640,480,24)
如果成功返回0
新闻热点
疑难解答