| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 817 人关注过本帖
标题:[求助]问一个改变桌面墙纸的问题
只看楼主 加入收藏
leon2
Rank: 3Rank: 3
等 级:新手上路
威 望:7
帖 子:731
专家分:0
注 册:2005-3-18
结帖率:100%
收藏
 问题点数:0 回复次数:2 
[求助]问一个改变桌面墙纸的问题
我以前用 VB 6 做了一个可以改变桌面墙纸的程序,是用 SystemParametersInfo 函数实现的,可是我发现只能将 BMP 文件作为桌面墙纸,不能使用 JPG 文件。但是我发现 Windows 的设置中是可以将 JPG 文件作为桌面墙纸的,请问这是怎么实现呢?求助各位,谢谢了。
搜索更多相关主题的帖子: 墙纸 
2005-07-18 20:25
leon2
Rank: 3Rank: 3
等 级:新手上路
威 望:7
帖 子:731
专家分:0
注 册:2005-3-18
收藏
得分:0 
没人答吗?顶一下。
2005-07-20 22:00
griefforyou
Rank: 6Rank: 6
等 级:贵宾
威 望:27
帖 子:3336
专家分:0
注 册:2004-4-15
收藏
得分:0 

图片附件: 游客没有浏览图片的权限,请 登录注册
Option Explicit

Private Sub cmbBrowse_Click()

With CommonDialog1 .Flags = cdlOFNFileMustExist Or cdlOFNHideReadOnly Or cdlOFNLongNames Or cdlOFNExplorer .FileName = txtFilename.Text .ShowOpen If .FileName <> "" Then txtFilename.Text = .FileName End With End Sub

Private Sub cmdChange_Click()

Dim style As WPSTYLE If optStyle(2).Value Then style = WPSTYLE_STRETCH ElseIf optStyle(1).Value Then style = WPSTYLE_TILE Else style = WPSTYLE_CENTER End If SetActiveDesktopWallpaper txtFilename.Text, style, (chkForce.Value = vbChecked) End Sub

Private Sub cmdExit_Click() Unload Me End Sub

Private Sub Form_Load()

Dim ad As ActiveDesktop Dim sCurrentFile As String Dim wpo As WALLPAPEROPT wpo.dwSize = Len(wpo) sCurrentFile = String$(260, 0) ' check current options Set ad = New ActiveDesktop ad.GetWallpaper sCurrentFile, 260, 0 ad.GetWallpaperOptions wpo, 0 Set ad = Nothing txtFilename.Text = sCurrentFile optStyle(wpo.dwStyle And &H3&).Value = True End Sub

'' '' Sub SetActiveDesktopWallpaper '' '' sFileName: [in] Path to the new wallpaper '' lStyle: [in] Wallpaper style flag (center/stretch/tile) '' fForce: [in] Enables Active Desktop if it's currently disabled '' Private Sub SetActiveDesktopWallpaper(ByVal sFileName As String, ByVal lStyle As Long, ByVal fForce As Boolean)

Dim ad As ActiveDesktop Dim co As COMPONENTSOPT Dim wpo As WALLPAPEROPT Set ad = New ActiveDesktop ' check if AD is enabled co.dwSize = Len(co) ad.GetDesktopItemOptions co, 0& If (co.fActiveDesktop = 0) And fForce Then co.fActiveDesktop = 1 ad.SetDesktopItemOptions co, 0& End If With wpo .dwSize = Len(wpo) .dwStyle = lStyle End With With ad ' set wallpaper style... .SetWallpaperOptions wpo, 0& ' ... and wallpaper path .SetWallpaper sFileName, 0& ' finally, save changes .ApplyChanges AD_APPLY_ALL End With Set ad = Nothing End Sub


天津网站建设 http://www./
2005-07-24 16:02
快速回复:[求助]问一个改变桌面墙纸的问题
数据加载中...
 
   



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

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