vb中如何修改屏幕分辨率
vb中如何修改屏幕分辨率?网上有好多例子,但都是针对9X系统的了,在XP系统中不起作用了。因为xp系统增加了权限的概念,并不是直接调用函数就能实现功能了,比如关机的exi...
vb中如何修改屏幕分辨率?
网上有好多例子,但都是针对9X系统的了,在XP系统中不起作用了。因为xp系统增加了权限的概念,并不是直接调用函数就能实现功能了,比如关机的exitwindows这个函数,如果比提高程序权限就只能注销不能关机,等等。
其实问题的关键在于如何提高程序在系统中的权限,使得在9X系统下管用的api函数也能起到作用。
现在急须实现这个功能,我尝试过改注册表,也没有成功,不过还是希望用程序实现。
各位有没有什么好办法。。。 展开
网上有好多例子,但都是针对9X系统的了,在XP系统中不起作用了。因为xp系统增加了权限的概念,并不是直接调用函数就能实现功能了,比如关机的exitwindows这个函数,如果比提高程序权限就只能注销不能关机,等等。
其实问题的关键在于如何提高程序在系统中的权限,使得在9X系统下管用的api函数也能起到作用。
现在急须实现这个功能,我尝试过改注册表,也没有成功,不过还是希望用程序实现。
各位有没有什么好办法。。。 展开
1个回答
展开全部
我有个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
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
微测检测5.10
2023-05-10 广告
2023-05-10 广告
您好!建议咨 深圳市微测检测有限公司,已建立起十余个专业实验室,企业通过微测检测就可以获得一站式的测试与认 证解决方案;(EMC、RF、MFi、BQB、QI、USB、安全、锂电池、快充、汽车电子EMC、汽车手机互 联、语音通话质量),认证遇...
点击进入详情页
本回答由微测检测5.10提供
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询