我正在用VB.NET编写一个程序,它需要获取当前用户的墙纸的路径。有没有人知道能做到这一点的方法?
发布于 2011-02-01 16:50:22
您可以从注册表中读取当前的墙纸。不需要任何API调用。下面是实现这一点的代码
Private Function GetCurrentWallpaper() As String
' The current wallpaper path is stored in the registry at HKCU\Control Panel\Desktop\WallPaper
Dim rkWallPaper As RegistryKey = Registry.CurrentUser.OpenSubKey("Control Panel\Desktop", False)
Dim WallpaperPath As String = rkWallPaper.GetValue("WallPaper").ToString()
rkWallPaper.Close()
' Return the current wallpaper path
Return WallpaperPath
End Function发布于 2015-03-05 02:35:57
我知道现在已经很晚了,但对其他人来说...如果桌面背景(墙纸)是图片(不是纯色),您可以在目录中找到当前图片:
"C:\Users\ {用户名} \AppData\Roaming\Microsoft\Windows\Themes\“
发布于 2011-02-01 03:41:33
您必须使用SPI_GETDESKWALLPAPER调用SystemParametersInfo()。返回墙纸位图文件的路径。有关所需声明,请访问pinvoke.net。
https://stackoverflow.com/questions/4855214
复制相似问题