Solved

desktop image change

Posted on 2001-06-10
4
176 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
[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
  • 3
4 Comments
 
LVL 9

Expert Comment

by:ginsonic
ID: 6175378
...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
ID: 6175400
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
ID: 6175473
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
ID: 7206937
the 98 way will do thanx
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

733 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