uses
Registry;
procedure ChangeWallpaper(bitmap: string); {bitmap contains filename: *.bmp}
var pBitmap : pchar;
begin
bitmap:=bitmap+#0;
pBitmap:=@bitmap[1];
SystemParametersInfo(SPI_SETDESKWALLPAPER, 0, pBitmap, SPIF_UPDATEINIFILE);
end;
procedure TForm1.Button1Click(Sender: TObject);
var
Ini: TregIniFile;
res: boolean;
begin
if OpenPictureDialog1.Execute then
begin
Ini := TRegIniFile.Create('Control Panel');
Ini.WriteString('desktop', 'Wallpaper', '');//OpenPictureDialog1.FileName);
Ini.WriteString('desktop', 'TileWallpaper', '1'); Ini.Free;
res := SystemParametersInfo(SPI_SETDESKWALLPAPER,0,nil,SPIF_SENDWININICHANGE);
end;
end;