MY SOFTHOUSE
BOOKMARK
SOFTWARE
FRIEND
EMAIL
EDIT
SIGN OUT
HELP
 
  首页   资讯   网摘   软件下载   问知   动漫娱乐   软件供求   软件商城   论坛   
 资讯
 资讯 >> 编程语言 >> VB
email给朋友】 浏览字号:【 】 【打印】 【关闭窗口
相关资讯  
相关文摘  
相关软件  
 



用VB制作自动更换墙纸的小软件

---- 这个小软件的功能,自然无法同久已成名的WPC(wallpaper changer)相媲美,但由于是自制的,用起来又别有一番乐趣。古人言,“独乐”不如“众乐”,所以我拿出来与大家共享,又希望能让初学者对于VB编程窥见一斑。

---- 这个小软件所用控件仅一列表框,两文本框,两标签,两命令及一定时控件而已。其界面如下:

 

---- 源代码:

Declare Function SystemParametersIn
fo Lib "user32" Alias "SystemParametersInfoA"
(ByVal uAction As Long, ByVal uParam As Long,
ByVal lpvParam As Any, ByVal fuWinIni As Long)
As Long


Dim flag As Boolean
Const SPI_SETDESKWALLPAPER = 20
Const SPIF_UPDATEINIFILE = &H1
    'update Win.ini Constant
Const SPIF_SENDWININICHANGE = &H2
    'update Win.ini and tell everyone

Private Sub CmdCancel_Click()
flag = False
Textpath = ""
Textintval = ""
Listfile.Clear
End Sub

Private Sub CmdOK_Click()
Dim temp As String
temp = Textpath.Text
If temp = "" Then End
If Right$(temp, 1) < > "\" Then
temp = temp + "\"
End If
Listfile.Tag = temp
temp = temp + "*.bmp"
temp = Dir$(temp)
While temp < > ""
Listfile.AddItem temp
temp = Dir$
Wend
Listfile.AddItem "None"
Show
Listfile.ListIndex = 0
If Listfile.List(0) = "None" Then
flag = False
Else
flag = True
End If
End Sub

Private Sub Form_Load()
flag = False
Timer1.Interval = Val(Textintval.Text)
End Sub

Private Sub Timer1_Timer()
Dim temp As String
Dim bmpfile As String
If flag Then
temp = Listfile.Tag
bmpfile = temp + Listfile.List(Listfile.ListIndex)
SystemParametersInfo SPI_SETDESKWALLPAPER,
        0, bmpfile, SPIF_UPDATEINIFILE
If Listfile.ListIndex = Listfile.ListCount - 1 Then
Listfile.ListIndex = 0
End If
Listfile.ListIndex = Listfile.ListIndex + 1
End If
End Sub


出处: VB大世界/潘建明 日期: 2005-1-7 好:2 一般:0 差:0
 
评论
  发表评论 投票: 一般
 
通知管理员(希望管理员根据你的评论修改软件信息)
  TrackBack
 
返回主页 | 关于我们 | 免责声明 | 联系广告| 读者投稿 | 友情链接 | 诚聘英才
  Copyright © 2004-2008 Forlink Technologies All Rights Reserved 
版权所有 时力科技 联系:客户服务中心 京ICP证030637号