生活已是百般艰难,为何不努力一点。下面图老师就给大家分享动态改变屏幕设置,希望可以让热爱学习的朋友们体会到设计的小小的乐趣。
【 tulaoshi.com - 编程语言 】
我们经常看到许多Win95的应用程序(尤其是游戏)在运行它的时候改变屏幕的设置,运行完后恢复,在VB中,我们可以用以下方法实现: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
来源:http://www.tulaoshi.com/n/20160219/1623166.html