Var
Reg:Tregistry
Begin
Reg:=Tregistry.Create;
Reg.Rootkey:= Hkey_Current_User;
Reg.OpenKey′Control Panel\Desktop′,False);
Reg.WriteString (''TileWallPaper'',''0'');
Reg.WriteString(''Wallpaper'',FileName);
Reg.WriteString(''WallpaperStyle'',''0'');
//FileName:为壁纸的文件名
//WallpaperStyle为壁纸的显示方案 0--居中 1--平铺 2--拉伸
Systemparametersinfo(SPI_SETDESKWallpaper,0,Nil,SPIF_SendChange);{向Windows发送消息,通知Windows更换壁纸}
Reg.CloseKey;{将更改内容写入
注册表并关闭}
Reg.Free;{释放对象}
End;