Removing and restoring the desktop wallpaper?

Is there a way to remove the desktop wallpaper, and then later restore the previous desktop wallpaper?
(across all windows platforms..)
I've been trying SystemParametersInfo(SPI_SETDESKWALLPAPER,0,nil,SPIF_UPDATEINIFILE)
but it doesn't seem to remove the wallpaper properly in windows NT or XP...

Chris NillissenChief ProgrammerAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Slick812Commented:
hello ChrisNillissen, The Walpaper info is stored in the Resgistry under HK_CurrentUser\ControlPanel\DeskTop

here is some code that will change the wallpaper, if you set the WallPaper string to '' then it should remove the wallpaper, button Click code


procedure TForm1.but_SetClick(Sender: TObject);
var
  RegI : TRegIniFile;
begin
if FileListBox1.ItemIndex < 0 then Exit;
RegI := TRegIniFile.Create('Control Panel\Desktop');
try
with RegI do
  begin
  WriteString('', 'Wallpaper', FileListBox1.FileName);
  //WriteString('', 'Wallpaper', 'C:\Documents and Settings\Wes\Local Settings\Application Data\Microsoft\Wallpaper1.bmp');
  if CheckBoxTile.Checked then
    begin
    WriteString('', 'TileWallpaper', '1');
    WriteString('', 'WallpaperStyle', '0');
    end else
    begin
    WriteString('', 'TileWallpaper', '0');
    if CheckBoxStretch.Checked then
      WriteString('', 'WallpaperStyle', '2') else
      WriteString('', 'WallpaperStyle', '0');
    end;
  SystemParametersInfo(SPI_SETDESKWALLPAPER, 0, Nil, SPIF_SENDWININICHANGE);
  end;
  finally
  RegI.Free;
  end;

end;

 - - - - - - - -  --  - - - - - - -
ask questions if you need more
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Slick812Commented:
Oh if you want to restore the wallpaper then you will need to ReadString for Wallpaper and store it and then writeString to put it back


OldWallPath := RegI.ReadString('','Wallpaper', '?');
0
CleanupPingCommented:
ChrisNillissen:
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
EXPERTS:
Post your closing recommendations!  No comment means you don't care.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Delphi

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.