vb6 - Windows 壁纸 : not just BMPs?

标签 vb6 registry desktop-wallpaper

我在几个地方读到桌面墙纸可以设置为 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

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

最佳答案

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

您可以尝试将 HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer\ForceActiveDesktopOn 设置为 1(找到 here)。

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

关于vb6 - Windows 壁纸 : not just BMPs?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/80307/

相关文章:

python - Windows 中的多显示器设置的每个屏幕都有不同的墙纸

arrays - VB6中数组索引是从0开始的吗?

registry - 如何检测系统中的FTDI驱动程序

Delphi - 将 NtCreateKey 与 HKCU 结合使用

delphi - 如何在 Windows 中拍摄没有背景/壁纸图片的整个桌面的屏幕截图

vb6 - 我可以将字符串、单曲等设置为 ""和零吗?

vb6 - 仅在文本框中允许数字值

excel - 我可以在 VBA 中使用 .res(资源)文件吗?这样做有好处吗?

windows - 从操作系统级别配置中删除环境变量的命令行