示例#1
0
        public string GetCurrentWallpaperPath()
        {
            //Attempts the return the currently set wallpaper path
            string currentWallpaper = new string('\0', 260);

            Natives.SystemParametersInfo((uint)Natives.SPIWALL.GET, currentWallpaper.Length, currentWallpaper, 0);
            currentWallpaper = currentWallpaper.Substring(0, currentWallpaper.IndexOf('\0'));
            return(currentWallpaper);
        }
示例#2
0
        public PassiveWallpaper()
        {
            InitializeComponent();
            int    monId = 0;
            string msg   = "";

            //Fill out monitor info so the user knows which screen is selected when choosing a gif location
            foreach (Screen screen in Screen.AllScreens)
            {
                string str = $"Monitor {monId}: {screen.Bounds.Width} x {screen.Bounds.Height} @ {screen.Bounds.X},{screen.Bounds.Y} Primary: {screen.Primary}\n";
                msg += str;
                monId++;
            }

            //Attempt to fetch the current wallpaper path.
            string currentWallpaper = new string('\0', 260);

            Natives.SystemParametersInfo((uint)Natives.SPIWALL.GET, currentWallpaper.Length, currentWallpaper, 0);
            currentWallpaper = currentWallpaper.Substring(0, currentWallpaper.IndexOf('\0'));

            monitor_info.Text      = msg;
            numericUpDown1.Maximum = monId - 1;

            //Set closing events to remove spawned forms and moved windows.
            if (!File.Exists(currentWallpaper))
            {
                //If current wallpaper path is not set then warn the user.
                var message = $"Your currently set wallpaper {currentWallpaper} doesn't exist on file ie. you have moved it since it was set.\n" +
                              "It is recommended that you set your wallpaper prior to using this tool.\n" +
                              "This is because when disabling the overlays the program sets your wallpaper in order to \"refresh\" your desktop back to the original state.";
                MessageBox.Show(message);
                Closing += (a, b) =>
                {
                    disable_all(false);
                    RestoreMovedProcesses();
                };
            }
            else
            {
                Closing += (a, b) => {
                    disable_all();
                    RestoreMovedProcesses();
                };
            }
        }
示例#3
0
 /// <summary>
 /// Sets the current wallpaper with the image at it's designated path. Can cause issues/black wallpaper if path incorrect/not set.
 /// </summary>
 public void SetImage()
 {
     Natives.SystemParametersInfo((uint)Natives.SPIWALL.SET, 0, GetCurrentWallpaperPath(), Natives.SPIF.SPIF_UPDATEINIFILE | Natives.SPIF.SPIF_SENDCHANGE);
 }