标题:????
只看楼主
tvrc200379
Rank: 1
等 级:新手上路
帖 子:351
专家分:0
注 册:2004-3-30
 问题点数:0 回复次数:5 
????

我的显示是1024*768我想做个程序把显示变成800*600,谁知怎么样做啊!说一下啊O
2004-04-11 16:31
tvrc200379
Rank: 1
等 级:新手上路
帖 子:351
专家分:0
注 册:2004-3-30
得分:0 
怎么没人知道啊!

我是灌水天堂的新版主,请新老用户来报道啊 (欢迎来灌水。。。) 哈哈哈。。。。 http://websx.home./bbs/list.asp?boardid=35
2004-04-12 13:32
griefforyou
Rank: 6Rank: 6
等 级:贵宾
威 望:27
帖 子:3336
专家分:0
注 册:2004-4-15
得分:0 

如何改变屏幕的分辨率?

 

对于很多VB程序员来说怎样改变屏幕的分辨率一直是一个难题,而且在API-Viewer里竟然没有EnumDisplaySettings和ChangeDisplaySettings!!遵从以下的步骤,你就可以改变屏幕的分辨率。将以下代码加入模块文件:

 

Declare Function EnumDisplaySettings Lib "user32" _

Alias "EnumDisplaySettingsA" _

(ByVal lpszDeviceName As Long, _

ByVal iModeNum As Long, _

lpDevMode As Any) As Boolean

Declare Function ChangeDisplaySettings Lib "user32" _

Alias "ChangeDisplaySettingsA" _

(lpDevMode As Any, ByVal dwFlags As Long) As Long

 

Declare Function ExitWindowsEx Lib "user32" _

(ByVal uFlags As Long, ByVal dwReserved As Long) As Long

Public Const EWX_LOGOFF = 0

Public Const EWX_SHUTDOWN = 1

Public Const EWX_REBOOT = 2

Public Const EWX_FORCE = 4

Public Const CCDEVICENAME = 32

Public Const CCFORMNAME = 32

Public Const DM_BITSPERPEL = &H40000

Public Const DM_PELSWIDTH = &H80000

Public Const DM_PELSHEIGHT = &H100000

Public Const CDS_UPDATEREGISTRY = &H1

Public Const CDS_TEST = &H4

Public Const DISP_CHANGE_SUCCESSFUL = 0

Public Const DISP_CHANGE_RESTART = 1

Type DEVMODE

dmDeviceName As String * CCDEVICENAME

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 * CCFORMNAME

dmUnusedPadding As Integer

dmBitsPerPel As Integer

dmPelsWidth As Long

dmPelsHeight As Long

dmDisplayFlags As Long

dmDisplayFrequency As Long

End Type

 

2、下面的例子将演示如何把屏幕分辨率更改为640x480(保持原来的颜色数)。

 

Dim DevM As DEVMODE

'DevM收集信息

erg& = EnumDisplaySettings(0&, 0&, DevM)

'不改变颜色数目是因为如果改变颜色数就要重新启动

 

DevM.dmFields = DM_PELSWIDTH Or DM_PELSHEIGHT 'Or DM_BITSPERPEL

DevM.dmPelsWidth = 640 '屏幕宽度

DevM.dmPelsHeight = 480 '屏幕高度

'DevM.dmBitsPerPel = 32 (还可以为 8, 16, 32甚至4)

'改变显示模式并检查是否可能

erg& = ChangeDisplaySettings(DevM, CDS_TEST)'检查是否成功 Select Case erg&

Case DISP_CHANGE_RESTART

an = MsgBox("你现在必须重新启动系统,执行吗?", vbYesNo + vbSystemModal, "消息")

If an = vbYes Then erg& = ExitWindowsEx(EWX_REBOOT, 0&)

End If

Case DISP_CHANGE_SUCCESSFUL

erg& = ChangeDisplaySettings(DevM, CDS_UPDATEREGISTRY)

MsgBox "一切正常!", vbOKOnly + vbSystemModal, "成功"

Case Else

MsgBox "显示模式不支持", vbOKOnly + vbSystemModal, "错误"End Select

End Sub


天津网站建设 http://www./
2004-04-18 11:55
tvrc200379
Rank: 1
等 级:新手上路
帖 子:351
专家分:0
注 册:2004-3-30
得分:0 
不错啊,不知在XP或者2000下是不是好用啊

我是灌水天堂的新版主,请新老用户来报道啊 (欢迎来灌水。。。) 哈哈哈。。。。 http://websx.home./bbs/list.asp?boardid=35
2004-04-20 10:45
griefforyou
Rank: 6Rank: 6
等 级:贵宾
威 望:27
帖 子:3336
专家分:0
注 册:2004-4-15
得分:0 
试试吧,应该好用的。。。

天津网站建设 http://www./
2004-04-20 14:05
tvrc200379
Rank: 1
等 级:新手上路
帖 子:351
专家分:0
注 册:2004-3-30
得分:0 

知了


我是灌水天堂的新版主,请新老用户来报道啊 (欢迎来灌水。。。) 哈哈哈。。。。 http://websx.home./bbs/list.asp?boardid=35
2004-04-24 15:46



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-80-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.064799 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved