Arsip: Mengubah Wallpaper dari Program


by LuriDarmawan in Articles more 15 years ago 999
Banyak aplikasi termasuk diantaranya browser internet memiliki fitur untuk mengubah wallpaper. Kode berikut memungkinkan para delphist untuk mencobanya juga.
program wallpapr;
uses
Registry, WinProcs;
procedure SetWallpaper( sWallpaperBMPPath : String; bTile : boolean );
var
reg : TRegIniFile;
begin
// 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
// delphi.bmp akan dijadikan wallpaper rata tengah
SetWallpaper( 'c:/delphi.bmp', False );
end.
Local Business Directory, Search Engine Submission & SEO Tools FreeWebSubmission.com SonicRun.com