主题:初次来到这论坛小弟有个问题要问.以后会常来
Dim h, v, color As Long
Dim vcol As Integer, vrow As Integer, vitcolor As Integer
Private Sub Command1_Click()
setdispmode vrow, vcol, vbitcolor
End Sub
Private Sub Command2_Click()
setdispmode CInt(h), CInt(v), CInt(color)
End Sub
Private Sub Command3_Click()
Unload Me
End Sub
Private Sub Form_Load()
'保存最初的屏幕设置
h = getdevicecaps(Me.hdc, horzres)
v = getdevicecaps(Me.hdc, vhorzres)
color = getdevicecaps(Me.hdc, bitspixel)
End Sub
Private Sub Option1_Click()
If Option1 = True Then
vcol = 480
vrow = 640
vbitcolor = 16
Option2.Value = False
Option3.Value = False
Option4.Value = False
Option5.Value = False
End If
End Sub
Private Sub Option2_Click()
If Option2 = trie Then
vcol = 480
vrow = 640
vbitcolor = 32
Option1.Value = False
Option3.Value = False
Option4.Value = False
Option5.Value = False
End If
End Sub
Private Sub Option3_Click()
If Option3 = True Then
vcol = 600
vrow = 800
vbitcolor = 16
Option1.Value = False
Option2.Value = False
Option4.Value = False
Option5.Value = False
End If
End Sub
Private Sub Option4_Click()
If Option4 = True Then
vcol = 600
vrow = 800
vbitcolor = 32
Option1.Value = False
Option2.Value = False
Option3.Value = False
Option5.Value = False
End Sub
Private Sub Option5_Click()
If Option5 = True Then
vcol = 600
vrow = 800
vbitcolor = 16
Option1.Value = False
Option2.Value = False
Option3.Value = False
Option4.Value = False
End Sub
-------------------------------------------------------------------------------------Declare Function getdevicecaps Lib "gdi32" (ByVal hdc As Long, ByVal nindex As Long) As Long '取指定设备的信息API函数
'三个屏幕常量
Public Const horzres = 8
Public Const vhorzres = 10
Public Const bitspixel = 12
Private Declare Function lstrcpy Lib "kernel32" Alias "lstrcpyA" (lpstringl As Any, lpstring2 As Any) As Long
Const CCHDEVICENAME = 32
Const CCHFORMNAME = 32
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
dmformname As String * CCHFORMNAME
dmunusedpadding As Integer
dmbitsperpel As Integer
dmpelswidth As Long
dmpelsheight As Long
dmdisplayfrequency As Long
End Type
Private Declare Function changedisplaysettings Lib "user32" Alias "changedisplaysettingsa" (ByVal lpdevmode As Long, ByVal dwflags As Long) As Long
Public Function setdispmode(width As Integer, height As Integer, color As Integer) As Long
Const dm_pelswidth = &H80000
Const dm_pelsheight = &H100000
Const dm_bitsperpel = &H40000
Dim newdevmode As DEVMODE
Dim pdevmode As Long
With newdevmode.dmsize = 122
If color = 0 Then
'如果color=0则只能改变屏幕的分辨率,而不改变色彩/
.dmfields = dm_pelswidth Or dm_pelsheight
Else
'如果color不等0则改变屏幕的分辨率和色彩
.dmfileds dm_pelswidth Or dm_pelsheight Or dm_bitsperpel
End If
.dmpelswidth = width
.dmpelsheight = height
If color <> 0 Then
.dmbitsperpel = color
End If
End With
pdevmode = lstrcpy(newdevmode, newdevmode)
'得到一个指向newdevmode结构的long型的指针.
changedisplaysettings pdevmode, 0
End Function
End Function
第一部分是form窗体中的代码
后面这部分是模块声明中的代码.
为什么我一运行就提示错误呢 453错误 说找不到dll入口点getdevicecaps in gdi32这个错误喔
高手来看看 我这都是照书写的学呢.!
Dim vcol As Integer, vrow As Integer, vitcolor As Integer
Private Sub Command1_Click()
setdispmode vrow, vcol, vbitcolor
End Sub
Private Sub Command2_Click()
setdispmode CInt(h), CInt(v), CInt(color)
End Sub
Private Sub Command3_Click()
Unload Me
End Sub
Private Sub Form_Load()
'保存最初的屏幕设置
h = getdevicecaps(Me.hdc, horzres)
v = getdevicecaps(Me.hdc, vhorzres)
color = getdevicecaps(Me.hdc, bitspixel)
End Sub
Private Sub Option1_Click()
If Option1 = True Then
vcol = 480
vrow = 640
vbitcolor = 16
Option2.Value = False
Option3.Value = False
Option4.Value = False
Option5.Value = False
End If
End Sub
Private Sub Option2_Click()
If Option2 = trie Then
vcol = 480
vrow = 640
vbitcolor = 32
Option1.Value = False
Option3.Value = False
Option4.Value = False
Option5.Value = False
End If
End Sub
Private Sub Option3_Click()
If Option3 = True Then
vcol = 600
vrow = 800
vbitcolor = 16
Option1.Value = False
Option2.Value = False
Option4.Value = False
Option5.Value = False
End If
End Sub
Private Sub Option4_Click()
If Option4 = True Then
vcol = 600
vrow = 800
vbitcolor = 32
Option1.Value = False
Option2.Value = False
Option3.Value = False
Option5.Value = False
End Sub
Private Sub Option5_Click()
If Option5 = True Then
vcol = 600
vrow = 800
vbitcolor = 16
Option1.Value = False
Option2.Value = False
Option3.Value = False
Option4.Value = False
End Sub
-------------------------------------------------------------------------------------Declare Function getdevicecaps Lib "gdi32" (ByVal hdc As Long, ByVal nindex As Long) As Long '取指定设备的信息API函数
'三个屏幕常量
Public Const horzres = 8
Public Const vhorzres = 10
Public Const bitspixel = 12
Private Declare Function lstrcpy Lib "kernel32" Alias "lstrcpyA" (lpstringl As Any, lpstring2 As Any) As Long
Const CCHDEVICENAME = 32
Const CCHFORMNAME = 32
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
dmformname As String * CCHFORMNAME
dmunusedpadding As Integer
dmbitsperpel As Integer
dmpelswidth As Long
dmpelsheight As Long
dmdisplayfrequency As Long
End Type
Private Declare Function changedisplaysettings Lib "user32" Alias "changedisplaysettingsa" (ByVal lpdevmode As Long, ByVal dwflags As Long) As Long
Public Function setdispmode(width As Integer, height As Integer, color As Integer) As Long
Const dm_pelswidth = &H80000
Const dm_pelsheight = &H100000
Const dm_bitsperpel = &H40000
Dim newdevmode As DEVMODE
Dim pdevmode As Long
With newdevmode.dmsize = 122
If color = 0 Then
'如果color=0则只能改变屏幕的分辨率,而不改变色彩/
.dmfields = dm_pelswidth Or dm_pelsheight
Else
'如果color不等0则改变屏幕的分辨率和色彩
.dmfileds dm_pelswidth Or dm_pelsheight Or dm_bitsperpel
End If
.dmpelswidth = width
.dmpelsheight = height
If color <> 0 Then
.dmbitsperpel = color
End If
End With
pdevmode = lstrcpy(newdevmode, newdevmode)
'得到一个指向newdevmode结构的long型的指针.
changedisplaysettings pdevmode, 0
End Function
End Function
第一部分是form窗体中的代码
后面这部分是模块声明中的代码.
为什么我一运行就提示错误呢 453错误 说找不到dll入口点getdevicecaps in gdi32这个错误喔
高手来看看 我这都是照书写的学呢.!