示例#1
0
        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);
        }
示例#2
0
        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);
        }