原始背景位置是否有 Windows 注册表项?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/4321915/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-09 07:48:54  来源:igfitidea点击:

Is there a windows registry entry for the original background location?

windowsbackgroundregistrywallpaper

提问by Bob

Is there a windows registry entry for the original background location? At "HKEY_CURRENT_USER\Control Panel\Desktop", the value "Wallpaper" is "C:\Users\CURRENTUSER\AppData\Roaming\Microsoft\Windows\Themes\TranscodedWallpaper.jpg".

原始背景位置是否有 Windows 注册表项?在“HKEY_CURRENT_USER\Control Panel\Desktop”,值“Wallpaper”是“C:\Users\CURRENTUSER\AppData\Roaming\Microsoft\Windows\Themes\TranscodedWallpaper.jpg”。

回答by Leo Davidson

It actually depends how the wallpaper got there.

这实际上取决于壁纸是如何到达那里的。

This works on Windows 7, when the wallpaper is set via the control panel and wallpaper slideshows are enabled:

这适用于 Windows 7,当通过控制面板设置墙纸并启用墙纸幻灯片时:

HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Desktop\General\WallpaperSource

In other situations, however, that key may not exist or may be stale.

但是,在其他情况下,该密钥可能不存在或可能已过时。

(Ignore the fact it has "Internet Explorer" in the path. Who knows why that is, but IE isn't involved!)

(忽略路径中有“Internet Explorer”这一事实。谁知道为什么会这样,但不涉及 IE!)

(FWIW, I found/used this when making a desktop context menu (via VBScript) to delete the current wallpaper. Here it isif it's useful.)

(FWIW,我在制作桌面上下文菜单(通过 VBScript)以删除当前壁纸时发现/使用了。如果它有用的话,这里是。)

回答by Deepu

In gpedit, the "Active Desktop Wallpaper" setting in User Configuration|Administrative Templates|Desktop|Active Desktop does set the background. Ignore the fact that it's in the Active Desktop section, as it still works with Active Desktop disabled. Active Desktop only needs to be enabled if using JPG or HTML for the background.

在 gpedit 中,用户配置|管理模板|桌面|活动桌面中的“活动桌面壁纸”设置确实设置了背景。忽略它位于 Active Desktop 部分的事实,因为它在禁用 Active Desktop 的情况下仍然有效。如果使用 JPG 或 HTML 作为背景,则仅需要启用 Active Desktop。

回答by besimler

You can write custom vb script and right click menu.

您可以编写自定义 vb 脚本和右键单击菜单。

--- Create reg file and double click.

--- 创建 reg 文件并双击。

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\DesktopBackground\Shell\DesktopWallpaperLocation]
"icon"="imageres.dll,-5346"
@="Desktop Wallpaper Location"

[HKEY_CLASSES_ROOT\DesktopBackground\Shell\DesktopWallpaperLocation\command]
@=hex(2):77,00,73,00,63,00,72,00,69,00,70,00,74,00,20,00,22,00,25,00,77,00,69,\
  00,6e,00,64,00,69,00,72,00,25,00,5c,00,53,00,79,00,73,00,74,00,65,00,6d,00,\
  33,00,32,00,5c,00,57,00,61,00,6c,00,6c,00,70,00,61,00,70,00,65,00,72,00,50,\
  00,61,00,74,00,68,00,2e,00,76,00,62,00,73,00,22,00,00,00

This will create a link to right menu like "Desktop Wallpaper Location" and it will open as selected in explorer.

这将创建一个指向右侧菜单的链接,例如“桌面壁纸位置”,它将在资源管理器中选择打开。

--- Vb script file (edited for multiple monitors).

--- Vb 脚本文件(为多显示器编辑)。

Const HKCU = &H80000001 'HKEY_CURRENT_USER

sComputer = "."

Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\" _
            & sComputer & "\root\default:StdRegProv")

sKeyPath = "Control Panel\Desktop\"
sValueName = "TranscodedImageCache_001"
oReg.GetBinaryValue HKCU, sKeyPath, sValueName, sValue
sContents = ""
For i = 24 To UBound(sValue)
  vByte = sValue(i)
  If vByte <> 0 And vByte <> "" Then
    sContents = sContents & Chr(vByte)
  End If
Next

arrValues = Split(sContents, "\")
b = ubound(arrValues)
result = arrValues(0)

CreateObject("Wscript.Shell").Run "explorer.exe /select,""" & result & """"

sValueName = "TranscodedImageCache_000"
oReg.GetBinaryValue HKCU, sKeyPath, sValueName, sValue
sContents = ""
For i = 24 To UBound(sValue)
  vByte = sValue(i)
  If vByte <> 0 And vByte <> "" Then
    sContents = sContents & Chr(vByte)
  End If
Next

arrValues = Split(sContents, "\")
b = ubound(arrValues)
result = arrValues(0)

CreateObject("Wscript.Shell").Run "explorer.exe /select,""" & result & """"

sValueName = "TranscodedImageCache"
oReg.GetBinaryValue HKCU, sKeyPath, sValueName, sValue
sContents = ""
For i = 24 To UBound(sValue)
  vByte = sValue(i)
  If vByte <> 0 And vByte <> "" Then
    sContents = sContents & Chr(vByte)
  End If
Next

arrValues = Split(sContents, "\")
b = ubound(arrValues)
result = arrValues(0)

CreateObject("Wscript.Shell").Run "explorer.exe /select,""" & result & """"

Save as *.vbs file and copy to c:\windows\system32 folder. (c:\windows\system32\WallpaperPath.vbs)

另存为 *.vbs 文件并复制到 c:\windows\system32 文件夹。(c:\windows\system32\WallpaperPath.vbs)