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