Solved

desktop image change

Posted on 2001-06-10
4
179 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

726 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