Solved

desktop image change

Posted on 2001-06-10
4
173 Views
Last Modified: 2010-04-06
Hi guys!

I wonder how to write a program that changes the desktop image at random each time the computer is turned on... Any ideas?

best regards,
Manuel Lopez (lopem)
0
Comment
Question by:lopem
  • 3
4 Comments
 
LVL 9

Expert Comment

by:ginsonic
Comment Utility
...change the desktop wallpaper ?



uses  
  Registry, WinProcs;  

procedure SetWallpaper(  
            sWallpaperBMPPath : String;  
            bTile : boolean );  
var  
  reg : TRegIniFile;  

begin  
  reg := TRegIniFile.Create('Control Panel\Desktop' );  
  with reg do  
  begin  
    WriteString( '', 'Wallpaper',  
      sWallpaperBMPPath );  
    if( bTile )then  
    begin  
      WriteString(  
        '', 'TileWallpaper', '1' );  
    end else  
    begin  
      WriteString(  
        '', 'TileWallpaper', '0' );  
    end;  
  end;  
  reg.Free;  
   

  SystemParametersInfo(  
    SPI_SETDESKWALLPAPER,  
    0,  
    Nil,  
    SPIF_SENDWININICHANGE );  
end;

0
 
LVL 9

Accepted Solution

by:
ginsonic earned 50 total points
Comment Utility
Or:
procedure ChangeIt;
var
  Reg: TRegIniFile;
begin
  Reg := TRegIniFile.Create('Control Panel');
  Reg.WriteString('desktop', 'Wallpaper', 'c:\windows\forest.bmp');
  Reg.WriteString('desktop', 'TileWallpaper', '1');
  Reg.Free;
  SystemParametersInfo(SPI_SETDESKWALLPAPER, 0, nil,
    SPIF_SENDWININICHANGE);
end;

Changing the wallpaper on a system with Active Desktop:

procedure ChangeActiveWallpaper;
const
  CLSID_ActiveDesktop: TGUID = '{75048700-EF1F-11D0-9888-006097DEACF9}';
var
  ActiveDesktop: IActiveDesktop;
begin
  ActiveDesktop := CreateComObject(CLSID_ActiveDesktop)
    as IActiveDesktop;
  ActiveDesktop.SetWallpaper('c:\windows\profiles\dave\desktop\fern.jpg', 0);
  ActiveDesktop.ApplyChanges(AD_APPLY_ALL or AD_APPLY_FORCE);
end;

0
 
LVL 9

Expert Comment

by:ginsonic
Comment Utility
Or just go to :
http://www.torry.net/util_desktop.htm
and download Wallpaper Changers v.1.00 . Source code included .
0
 
LVL 1

Expert Comment

by:catbecks
Comment Utility
the 98 way will do thanx
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

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…
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…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

771 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now