Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Removing and restoring the desktop wallpaper?

Posted on 2003-03-18
5
Medium Priority
?
446 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
  • 2
3 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

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

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

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Suggested Courses

580 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