[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

desktop image change

Posted on 2001-06-10
4
Medium Priority
?
186 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
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 200 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: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

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

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…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
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

825 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