文章探索:   分类:    关键字:  
  + 栏目导航
  + 相关文章
文本框中光标位置的获得
用VB导入导出你的IE收藏夹
VB应用程序访问SQL Server方法探讨
VB访问SQL Server数据库技术全揭密
自动上网抓数据的机器人
自己的IE——用VB制作浏览器
VB中如何保存Webbrowser中的整个页面..
在VB中该如何控制其它程序的弹出窗口..
保存webbrowser中的HTML内容
破译动网验证码的简单方法
轻松获取QQ密码
VB.NET获取硬盘序列号的方法
WEBBROWSER 技巧一(收藏)
VB自动登陆网络站点详解(二):Inet..
获取webbrowser控件网页的源码
WebBrowser控件说明
关于用VB做更漂亮的窗体的思考
VB中访问存储过程的几种办法
VB6中改变屏幕的分辨率和刷新频率
VB编写一个能显示百分比的自定义进度..
公农历转换VB类
VB.NET窗口渐淡关闭
使用VB实现邮箱自动注册(二):修改..
VB.NET轻松实现任务栏程序
VB.NET启动外部程序
利用vb实现图片上传
VB实现局域网内的文件传输
VB 一个Function传回多个值
在VB中实现多线程
VB 手机号码编码程序


技术教程 -> VB教程 ->  
VB6中改变屏幕的分辨率和刷新频率
来源:转载   人气:1811   录入时间:2007-11-8
    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




Copyright(C)2007-2024 广州市佳沛数码科技有限公司 版权所有
公司地址: 广州市荔湾区东漖北路560号511室
电话:020-81803473 传真:020-81544987