Many programs including major Internet browsers lets you change the Windows wallpaper. Here's how you can add similar functionality to your program:
program wallpapr;
uses
Registry, WinProcs;
procedure SetWallpaper(
sWallpaperBMPPath : String;
bTile : boolean );
var
reg : TRegIniFile;
begin
//
// change registry
//
// HKEY_CURRENT_USER
// Control PanelDesktop
// TileWallpaper (REG_SZ)
// Wallpaper (REG_SZ)
//
reg := TRegIniFile.Create(
'Control PanelDesktop' );
with reg do
begin
WriteString( '', 'Wallpaper',
sWallpaperBMPPath );
if( bTile )then
begin
WriteString(
'', 'TileWallpaper', '1' );
end else
begin
WriteString(
'', 'TileWallpaper', '0' );
end;
end;
reg.Free;
//
// let everyone know that we changed
// a system parameter
//
SystemParametersInfo(
SPI_SETDESKWALLPAPER,
0,
Nil,
SPIF_SENDWININICHANGE );
end;
begin
//
// set wallpaper to centered winnt.bmp
//
SetWallpaper(
'c:winntwinnt.bmp',
False );
end.
Listing #1 : Delphi code. Download
wallpapr (0.57 KB).