Windows 壁纸:不仅仅是 BMP?

发布于 2024-07-06 03:19:02 字数 826 浏览 16 评论 0原文

我在几个地方读到桌面壁纸可以设置为 HTML 文档。 有没有人成功地以编程方式更改它?

下面的 VB6 片段帮助我为 BMP 设置一些东西,但是当我尝试将它用于 HTML 时,我得到了漂亮的蓝色背景,没有其他任何东西。

Dim reg As New StdRegistry

Public Function CurrentWallpaper() As String
    CurrentWallpaper = reg.ValueEx(HKEY_CURRENT_USER, "Control Panel\Desktop", "Wallpaper", REG_SZ, "")
End Function

Public Sub SetWallpaper(cFilename As Variant)
    reg.ClassKey = HKEY_CURRENT_USER
    reg.SectionKey = "Control Panel\Desktop"
    reg.ValueKey = "Wallpaper"
    reg.ValueType = REG_SZ
    reg.Default = ""
    reg.Value = cFilename
End Sub

Public Sub RefreshDesktop()
    Dim oShell As Object
    Set oShell = CreateObject("WScript.Shell")
    oShell.Run "%windir%\System32\RUNDLL32.EXE user32.dll,UpdatePerUserSystemParameters", 1, True
End Sub

也许还需要一些其他设置。 有任何想法吗?

I've read in a couple of places that the desktop wallpaper can be set to an HTML document. Has anyone had any success changing it programmatically?

The following snippet of VB6 helps me set things up for BMPs but when I try to use it for HTML, I get a nice blue background and nothing else.

Dim reg As New StdRegistry

Public Function CurrentWallpaper() As String
    CurrentWallpaper = reg.ValueEx(HKEY_CURRENT_USER, "Control Panel\Desktop", "Wallpaper", REG_SZ, "")
End Function

Public Sub SetWallpaper(cFilename As Variant)
    reg.ClassKey = HKEY_CURRENT_USER
    reg.SectionKey = "Control Panel\Desktop"
    reg.ValueKey = "Wallpaper"
    reg.ValueType = REG_SZ
    reg.Default = ""
    reg.Value = cFilename
End Sub

Public Sub RefreshDesktop()
    Dim oShell As Object
    Set oShell = CreateObject("WScript.Shell")
    oShell.Run "%windir%\System32\RUNDLL32.EXE user32.dll,UpdatePerUserSystemParameters", 1, True
End Sub

Perhaps there's some other setting that's required. Any ideas?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

轻拂→两袖风尘 2024-07-13 03:19:06

更接近:http://www.microsoft .com/technet/prodtechnol/windows2000serv/reskit/w2rkbook/gp.mspx?mfr=true


But it turns out that I was getting sidetracked in Policy space. What I really wanted was to set the desktop in the userspace and let the Policy settings stand. Some helpful stuff was found here: http://blogs.msdn.com/coding4fun/archive/2006/10/31/912569.aspx.

然而,这不是最终的解决方案。 HTML 桌面的控制仍然遥不可及。


Seems that HTML settings are stored in HKCU\Software\Microsoft\Internet Explorer\Desktop\General. However, just storing them here doesn't seem to be enough. I still need to find the mechanism that lets Windows know which set of registry values to use.

Getting closer: http://www.microsoft.com/technet/prodtechnol/windows2000serv/reskit/w2rkbook/gp.mspx?mfr=true


But it turns out that I was getting sidetracked in Policy space. What I really wanted was to set the desktop in the userspace and let the Policy settings stand. Some helpful stuff was found here: http://blogs.msdn.com/coding4fun/archive/2006/10/31/912569.aspx.

This isn't the final solution, however. The control of HTML desktops is still out of reach.


Seems that HTML settings are stored in HKCU\Software\Microsoft\Internet Explorer\Desktop\General. However, just storing them here doesn't seem to be enough. I still need to find the mechanism that lets Windows know which set of registry values to use.

甜柠檬 2024-07-13 03:19:04

我推荐只使用 BMP 格式。 不要使用ActiveDetop,因为此后你的电脑运行速度会变慢。

I recomend only BMP format. Do not use ActiveDesctop, because you PC will work slowly after that.

一片旧的回忆 2024-07-13 03:19:03

好的,我已经找到了问题的答案,感谢 专家交流。 本质上,我们必须与 IActiveDesktop 对象对话。 在 VB6 中,可以在 VB6 - JPEG 作为壁纸(没有转换)

Okay, I've discovered the answer to my question, thanks to egl1044 on Experts Exchange. Essentially, one must talk to the IActiveDesktop object. A good implementation of that, in VB6, can be found at VB6 - JPEGs as wallpapers (without conversion).

甜柠檬 2024-07-13 03:19:03

我不确定是否有官方 API,但如果您愿意,您可以使用 Sysinternal 的 进程监视器 并查看当您通过 UI 设置 HTML 桌面背景时会触及哪些注册表项。 然后您只需要在代码中重复这些编辑即可。 然而,就向后/向前兼容性而言,API 调用要好得多。

I'm not sure if there's an official API for this, but if you have your heart set on it you could use Sysinternal's Process Monitor and see what registry keys get touched when you set an HTML desktop background via the UI. Then you'd just need to repeat those edits in your code. However, an API call would be far preferable in terms of backward/forward compatibility.

又怨 2024-07-13 03:19:02

我认为您需要确保“活动桌面”已打开。

您可以尝试将 HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer\ForceActiveDesktopOn 设置为 1(发现 此处)。

我没有尝试过,所以不能保证。

I think you need to make sure "Active Desktop" is turned on.

You might try setting HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer\ForceActiveDesktopOn to 1 (found here).

I haven't tried it, so no guarantees.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文