public static void NextWallpaper() { DesktopWallpaper.IDesktopWallpaper wallpaper = DesktopWallpaper.WallpaperWrapper.GetWallpaper(); Console.Out.WriteLine("Mon amount: " + wallpaper.GetMonitorDevicePathCount()); string monitor = wallpaper.GetMonitorDevicePathAt(0); Console.Out.WriteLine("mon id: " + monitor); wallpaper.AdvanceSlideshow(null, DesktopWallpaper.DesktopSlideshowDirection.Forward); Marshal.ReleaseComObject(wallpaper); }
public static void SetWallpaper(uint id, string path) { DesktopWallpaper.IDesktopWallpaper wallpaper = DesktopWallpaper.WallpaperWrapper.GetWallpaper(); if (id <= wallpaper.GetMonitorDevicePathCount()) { string monitor = wallpaper.GetMonitorDevicePathAt(id); wallpaper.SetWallpaper(monitor, path); } Marshal.ReleaseComObject(wallpaper); }