[All]
Changing the Desktop wallpaper using Delphi
By: Angel Martinez
Abstract: Explains how to use SystemParametersInfo function to change the Desktop wallpaper
Question
How do you change the Desktop wallpaper for Windows using Delphi?
Solution
You will use the SystemParametersInfo function found in the Windows API to set the desktop wallpaper. Drop a button on your form and in the OnClick event for the button place the following code:
procedure TForm1.Button1Click(Sender: TObject);
var
PicPath: String;
begin
PicPath := 'C:\WINNT\Prairie Wind.bmp';
SystemParametersInfo(SPI_SETDESKWALLPAPER, 0, pChar(PicPath), SPIF_SENDCHANGE)
end;
Connect with Us