| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 512 人关注过本帖
标题:[求助]如何在程序中动态的设置屏幕的分辨率?
只看楼主 加入收藏
yqrc
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2007-9-3
收藏
 问题点数:0 回复次数:1 
[求助]如何在程序中动态的设置屏幕的分辨率?
请各位高手帮忙!
搜索更多相关主题的帖子: 分辨率 屏幕 动态 
2007-09-10 15:06
simpson
Rank: 3Rank: 3
等 级:论坛游民
威 望:7
帖 子:863
专家分:17
注 册:2006-11-16
收藏
得分:0 

Option Explicit

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


全国最大的 Java专业电子书免费分享[url]http:///in.asp?id=xrmao[/url]
2007-09-10 15:32
快速回复:[求助]如何在程序中动态的设置屏幕的分辨率?
数据加载中...
 
   



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

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