Hej!
Jeg bruger denne kode:
SystemParametersInfo(SPI_SETDESKWALLPAPER,0,
PChar(OpenDialog1.FileName),
SPIF_SENDWININICHANGE);
- til at skifte baggrundsbillede fra Delphi programmer
Men resultatet er bare en helt blå baggrund
Hvorfor?
På forhånd tak
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.
Med venlig hilsen
Frede_Manden