🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.pascal.delphi.misc
Article #402

Re: How to change the WallPaper ??

#402
From: Gerhard Grosse
Date: Sun, 23 May 1999 00:00
40 lines
1691 bytes
"Chow Hoi Ka, Eric" wrote:
> 
> Hello,
> 
> 1) How to get the current WallPaper in the DeskTop ?
> 2) How to change the WallPaper ????
> 
> Best regards,
> Eric

Try this:

uses
  Registry;
var
  cReg: TRegistry;
  sOldWallPaper: string;
begin
  cReg := TRegistry.Create;
  with cReg do try
    RootKey := HKEY_CURRENT_USER;
    OpenKey('Control Panel\desktop',False);
    sOldWallPaper := ReadString('Wallpaper','');
    WriteString('Wallpaper','c:\windows\mywallpaper.bmp');
    CloseKey;
  finally
    Free;
  end;
end;

You probably also have to broadcast a WM_SETTINGSCHANGE message if you
change the wallpaper, but I'm not sure about that.

Alternatively use the Win32 API function SystemParametersInfo with the
SPI_SETDESKWALLPAPER flag (for reasons beyond my understanding,
SPI_GETDESKWALLPAPER does not exist).

Hope this helps.

Gerhard
Technical Details
Message-ID: <3748535F.E90FE04E@ph.tum.de>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <374834DD.6445E556@sftw.umac.mo>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: fd817,be2715f1a7fd097b,start
X-Google-Attributes: gidfd817,public
X-Google-Thread: 10baee,be2715f1a7fd097b,start
X-Google-Attributes: gid10baee,public
X-Google-Thread: 1043cf,be2715f1a7fd097b,start
X-Google-Attributes: gid1043cf,public
From: Gerhard Grosse <ggrosse@ph.tum.de>
Subject: Re: How to change the WallPaper ??
Date: 1999/05/23
Message-ID: <3748535F.E90FE04E@ph.tum.de>
X-Deja-AN: 481250965
Distribution: world
Content-Transfer-Encoding: 7bit
References: <374834DD.6445E556@sftw.umac.mo>
X-Accept-Language: de,en
Content-Type: text/plain; charset=us-ascii
Organization: Physics Dept. E15, TUM
Mime-Version: 1.0
Newsgroups: comp.lang.pascal.delphi.misc,alt.comp.lang.borland-delphi,borland.public.delphi.objectpascal