?
Solved

Removing and restoring the desktop wallpaper?

Posted on 2003-03-18
5
Medium Priority
?
444 Views
Last Modified: 2010-04-04
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...

0
Comment
Question by:Chris Nillissen
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
5 Comments
 
LVL 34

Accepted Solution

by:
Slick812 earned 100 total points
ID: 8167930
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
 
LVL 34

Expert Comment

by:Slick812
ID: 8167965
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
 

Expert Comment

by:CleanupPing
ID: 9316683
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

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Suggested Courses
Course of the Month14 days, 20 hours left to enroll

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question