vb中如何修改屏幕分辨率
vb中如何修改屏幕分辨率?网上有好多例子,但都是针对9X系统的了,在XP系统中不起作用了。因为xp系统增加了权限的概念,并不是直接调用函数就能实现功能了,比如关机的exi...
vb中如何修改屏幕分辨率?
网上有好多例子,但都是针对9X系统的了,在XP系统中不起作用了。因为xp系统增加了权限的概念,并不是直接调用函数就能实现功能了,比如关机的exitwindows这个函数,如果比提高程序权限就只能注销不能关机,等等。
其实问题的关键在于如何提高程序在系统中的权限,使得在9X系统下管用的api函数也能起到作用。
现在急须实现这个功能,我尝试过改注册表,也没有成功,不过还是希望用程序实现。
各位有没有什么好办法。。。 展开
网上有好多例子,但都是针对9X系统的了,在XP系统中不起作用了。因为xp系统增加了权限的概念,并不是直接调用函数就能实现功能了,比如关机的exitwindows这个函数,如果比提高程序权限就只能注销不能关机,等等。
其实问题的关键在于如何提高程序在系统中的权限,使得在9X系统下管用的api函数也能起到作用。
现在急须实现这个功能,我尝试过改注册表,也没有成功,不过还是希望用程序实现。
各位有没有什么好办法。。。 展开
展开全部
我有个2000下好用的 不知道XP好用不 你试一下吧!~
'模块代码
Option Explicit
Declare Function GetDeviceCaps Lib "gdi32" (ByVal hdc As Long, _
ByVal nIndex As Long) As Long
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
Public Const HORZRES = 8
Public Const VHORZRES = 10
Public Const VREFRESH = 116
Public Const BITSPIXEL = 12
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
Public Function SetDisplaymode(LngWidth As Long, LngHeight As Long, LngFrequency As Long) As Long
Dim NewDevmode As DEVMODE
Dim lngP As Long
EnumDisplaySettings 0&, 0&, NewDevmode
With NewDevmode
.dmFields = DM_PELSHEIGHT Or DM_PELSWIDTH Or DM_BITSPERPEL Or DM_DISPLAYFREQUENCY
.dmPelsWidth = LngWidth
.dmPelsHeight = LngHeight
If LngFrequency <> 0 Then
.dmDisplayFrequency = LngFrequency
End If
End With
SetDisplaymode = ChangeDisplaySettings(NewDevmode, 1)
End Function
'窗体代码
Private Sub Form_Load()
SetDisplaymode 1280, 1024, 0
End Sub
'模块代码
Option Explicit
Declare Function GetDeviceCaps Lib "gdi32" (ByVal hdc As Long, _
ByVal nIndex As Long) As Long
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
Public Const HORZRES = 8
Public Const VHORZRES = 10
Public Const VREFRESH = 116
Public Const BITSPIXEL = 12
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
Public Function SetDisplaymode(LngWidth As Long, LngHeight As Long, LngFrequency As Long) As Long
Dim NewDevmode As DEVMODE
Dim lngP As Long
EnumDisplaySettings 0&, 0&, NewDevmode
With NewDevmode
.dmFields = DM_PELSHEIGHT Or DM_PELSWIDTH Or DM_BITSPERPEL Or DM_DISPLAYFREQUENCY
.dmPelsWidth = LngWidth
.dmPelsHeight = LngHeight
If LngFrequency <> 0 Then
.dmDisplayFrequency = LngFrequency
End If
End With
SetDisplaymode = ChangeDisplaySettings(NewDevmode, 1)
End Function
'窗体代码
Private Sub Form_Load()
SetDisplaymode 1280, 1024, 0
End Sub
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
东莞大凡
2024-11-14 广告
2024-11-14 广告
标定板认准大凡光学科技,专业生产研发厂家,专业从事光学影像测量仪,光学投影测量仪.光学三维测量仪,光学二维测量仪,光学二维测量仪,光学三维测量仪,光学二维测量仪.的研发生产销售。东莞市大凡光学科技有限公司创立于 2018 年,公司总部坐落于...
点击进入详情页
本回答由东莞大凡提供
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询