Link to home
Start Free TrialLog in
Avatar of jonassondaniel
jonassondaniel

asked on

Set wallpaper

How do I set the wallpaper in windows in a "professional" way? I want to be able to choose alignment and tile on/of etc.
Avatar of BlackDeath
BlackDeath

hi, j.
try this:

procedure ChangeWallpaper(BmpName: string; Tile: Boolean);
var
  Reg: TRegIniFile;
begin
  Reg := TRegIniFile.Create('Control Panel');
  Reg.WriteString('desktop', 'Wallpaper' ,BmpName);
  if tile then
    Reg.WriteString('desktop', 'TileWallpaper', '1')
  else
    Reg.WriteString('desktop', 'TileWallpaper', '0');  
  Reg.Free;
  SystemParametersInfo(SPI_SETDESKWALLPAPER, 0, nil, SPIF_SENDWININICHANGE);
end;

& then call

ChangeWallpaper('C:\LOGO.BMP' , False);
Avatar of jonassondaniel

ASKER

thanks, blackdeath. it works nicely. Please "propose answer" so I can reward you.
ASKER CERTIFIED SOLUTION
Avatar of BlackDeath
BlackDeath

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial