Sprache: C#
Diese Methode gibt den Pfad zum aktuellen Desktop Hintergrundbild zurück.
benötigter Namespace:
using Microsoft.Win32;
/// <summary>
/// Gets the current wallpaper path.
/// </summary>
/// <returns>the wallpaper path</returns>
private static string GetCurrentWallpaperPath()
{
RegistryKey wallPaper = Registry.CurrentUser.OpenSubKey("Control Panel\Desktop", false);
string WallpaperPath = wallPaper.GetValue("WallPaper").ToString();
wallPaper.Close();
return WallpaperPath;
}
/// <summary>
/// Gets the current wallpaper path.
/// </summary>
/// <returns>the wallpaper path</returns>
private static string GetCurrentWallpaperPath()
{
RegistryKey wallPaper = Registry.CurrentUser.OpenSubKey("Control Panel\Desktop", false);
string WallpaperPath = wallPaper.GetValue("WallPaper").ToString();
wallPaper.Close();
return WallpaperPath;
}
Alte URL:
/snippet/pfad-des-desktop-hintergrundbild-ermitteln/610
bitte schreib noch die neuen Using-Klassen rein