| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1172 人关注过本帖
标题:大侠们帮忙看下程序谢谢了.!
只看楼主 加入收藏
b123456
Rank: 1
等 级:新手上路
帖 子:56
专家分:0
注 册:2008-9-22
收藏
 问题点数:0 回复次数:10 
大侠们帮忙看下程序谢谢了.!
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
--------------------------------------------------------------------------------------------------
搜索更多相关主题的帖子: color 
2008-10-17 22:16
multiple1902
Rank: 8Rank: 8
等 级:贵宾
威 望:42
帖 子:4881
专家分:671
注 册:2007-2-9
收藏
得分:0 
“大侠们帮忙看下程序谢谢了.!”
你以为改作文呢?

If Option2 = trie Then
trie变量没定义,算是True的错别字,扣2分。

讲点题外话,“Dim h, v, color As Long”定义下来的h和v是什么类型?
2008-10-17 22:18
b123456
Rank: 1
等 级:新手上路
帖 子:56
专家分:0
注 册:2008-9-22
收藏
得分:0 
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
2008-10-17 22:20
b123456
Rank: 1
等 级:新手上路
帖 子:56
专家分:0
注 册:2008-9-22
收藏
得分:0 
==这具体我还没发完呢嘿嘿
2008-10-17 22:20
b123456
Rank: 1
等 级:新手上路
帖 子:56
专家分:0
注 册:2008-9-22
收藏
得分:0 
3楼是模块的声明  为什么我一运行就提示错误呢  453错误 说找不到dll入口点getdevicecaps in gdi32这个错误喔
2008-10-17 22:21
b123456
Rank: 1
等 级:新手上路
帖 子:56
专家分:0
注 册:2008-9-22
收藏
得分:0 
好了..帮忙看下版主 谢谢了.
2008-10-17 22:21
b123456
Rank: 1
等 级:新手上路
帖 子:56
专家分:0
注 册:2008-9-22
收藏
得分:0 
版主来呀 看看来内`
2008-10-18 00:18
multiple1902
Rank: 8Rank: 8
等 级:贵宾
威 望:42
帖 子:4881
专家分:671
注 册:2007-2-9
收藏
得分:0 
程序代码:
End Function



End Function

...
2008-10-18 08:42
b123456
Rank: 1
等 级:新手上路
帖 子:56
专家分:0
注 册:2008-9-22
收藏
得分:0 
上楼  我删了一个end function  还是那样的错误,不是那的错误
2008-10-18 10:22
b123456
Rank: 1
等 级:新手上路
帖 子:56
专家分:0
注 册:2008-9-22
收藏
得分:0 
问题解决了 是声明问题
把模块声明换成Declare Function GetDeviceCaps Lib "gdi32" Alias "GetDeviceCaps" (ByVal hdc As Long, ByVal nIndex As Long) As Long
就OK了.!
2008-10-18 10:26
快速回复:大侠们帮忙看下程序谢谢了.!
数据加载中...
 
   



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

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