Click here to Skip to main content
15,879,348 members
Please Sign up or sign in to vote.
3.00/5 (1 vote)
See more:
I'm trying to write a program that creates a slideshow background for Windows 7 Starter. My current program works perfect in XP and on Windows 7 Starter it does nothing. It creates the temporary file just fine but won't set it to the background. When it's run on Windows 7 Home Premium it gives me a "generic error" when trying to run the command to change the background. Here is the portion of my script that actually sets the background:
C#
private void setBackground()
        {
            if (Counter >= files.Length)
                Counter = 0;
            if (File.Exists(files[Counter]))
            {
                files[Counter] = files[Counter].ToLower();
                using (Image img = Image.FromFile(files[Counter]))
                {
                    img.Save(tempPath, ImageFormat.Bmp);
                }
                try
                {
                    if (SystemParametersInfo(SPI_SETDESKWALLPAPER, 0, tempPath, SPIF_UPDATEINIFILE | SPIF_SENDWININICHANGE) != 0)
                    {
                        Counter += 1;
                    }
                    else
                    {
                        MessageBox.Show("There was an error in setting the wallpaper.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    }
                }
                catch
                {
                    MessageBox.Show("There was an error in setting the wallpaper.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }
            }
        }

And just to clear up any confusion about it, tempPath points to temp.bmp which is created in the windows directory, set programmatically so it will work the same way even with a non-default windows directory. After the defined interval time the file at tempPath is written over with the next file in the array. I'm guessing there is a problem with using SystemParametersInfo in Windows 7 and I realize this may not be possible in Windows 7 Starter but I find it hard to believe, and MSDN says nothing of either of these being true. Needless to say, a Google search has turned nothing up.
Posted

1 solution

Hi,

see here for more information:
http://social.answers.microsoft.com/Forums/en-US/w7install/thread/422801d5-89de-494d-8cc1-6f4fc21c2ac0[^]
It doesn't work since windows 7 starter does not allow changing the desktop wallpaper.
You can also google for "windows 7 starter limitations" to find more information.
 
Share this answer
 
Comments
LordXandor 10-Jan-11 12:46pm    
Well, I have found things online that talk about changing the registry key HKEY_CURRENT_USER/Control Panel/Desktop/Wallpaper (I believe that's what it is) to change the background image but I had no such luck, and even if I did this programmatically I would then still have to find a way to refresh it. I don't know, just knowing Microsoft, I would think with how lazy they are, they wouldn't actually remove the commands to change it, just remove the user option. And either way, this doesn't explain the error I got in Windows 7 Home Premium.
Astara 4-Jan-17 2:46am    
The above URL is invalid.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900