先修改注册表:
Reg:=TRegistry.Create;
try
begin
if Reg.OpenKey('Control Panel\DeskTop',false) then
begin
// TileWallpaper WallPaperStyle
//居中 0 0
//平铺 1 0
//拉伸 0 2
if ListView1.Items[CurrentWallpaper].SubItems[1]='居中' then
begin
TileWallpaper:=0;
WallPaperStyle:=0;
end
else if ListView1.Items[CurrentWallpaper].SubItems[1]='平铺' then
begin
TileWallpaper:=0;
WallPaperStyle:=2;
end
else
begin
TileWallpaper:=0;
WallPaperStyle:=2;
end; Reg.WriteString('TileWallPaper',IntToStr(TileWallpaper));
Reg.WriteString('WallPaperStyle',IntToStr(WallPaperStyle));
Reg.WriteString('WallPaper',ListView1.Items[CurrentWallpaper].SubItems[0]);
end;
Reg.CloseKey;
end;
finally
Reg.Free;
end;然后:
SystemParametersInfo(SPI_SETDESKWALLPAPER,0,nil,SPIF_SENDCHANGE);
Reg:=TRegistry.Create;
try
begin
if Reg.OpenKey('Control Panel\DeskTop',false) then
begin
// TileWallpaper WallPaperStyle
//居中 0 0
//平铺 1 0
//拉伸 0 2
if ListView1.Items[CurrentWallpaper].SubItems[1]='居中' then
begin
TileWallpaper:=0;
WallPaperStyle:=0;
end
else if ListView1.Items[CurrentWallpaper].SubItems[1]='平铺' then
begin
TileWallpaper:=0;
WallPaperStyle:=2;
end
else
begin
TileWallpaper:=0;
WallPaperStyle:=2;
end; Reg.WriteString('TileWallPaper',IntToStr(TileWallpaper));
Reg.WriteString('WallPaperStyle',IntToStr(WallPaperStyle));
Reg.WriteString('WallPaper',ListView1.Items[CurrentWallpaper].SubItems[0]);
end;
Reg.CloseKey;
end;
finally
Reg.Free;
end;然后:
SystemParametersInfo(SPI_SETDESKWALLPAPER,0,nil,SPIF_SENDCHANGE);
解决方案 »
- delphi7 quickreport 能否打印条码
- reportbuilder的问题,,急,20分给你啦
- 关于利用DBXPRESS开发三层架构的数据库应用程序
- 各位大哥,为什么小弟的信誉分突然少了2分,请各位指教.
- delphi6.0 安装包的制作 在线等
- 新手求救!!!在关闭一个窗体时,close事件里有代码,可我不想让这些代码起作用,该怎么做???-----50分!!!
- DIOCP开源项目-利用队列+0MQ+多进程逻辑处理,搭建稳定,高效,分布式的服务端
- QuickReport中自动增加和显示TQRDBText问题??大大给分了,请大家帮忙!!
- 请教如何将chart中的图形保存成bitmap图形文件,解决者比给分
- 怎么判断一个程序正在运行,不能让程序重复启动
- sql 语句问题
- 高手请作答,这个错误怎么解决?
var
ImageFileType: String;
WinDirWPFile: PChar;
WinDirLen: integer;
myReg: TRegistry;
begin
WinDirWPFile := StrAlloc(256); //get the windows dir
WinDirLen := GetWindowsDirectory(WinDirWPFile, 0);
GetWindowsDirectory(WinDirWPFile, WinDirLen);
StrCat(WinDirWPFile, '\');
StrCat(WinDirWPFile, wpFilename);
SetFileAttributes(WinDirWPFile, FILE_ATTRIBUTE_NORMAL); ImageFileType := Uppercase(ExtractFileExt(FileName));
if ImageFileType = '.JPG'
then Jpg2Bmp(FileName, WinDirWPFile) //jpeg
else if ImageFileType = '.BMP'
then copyfile(FileName, WinDirWPFile); //bmp myReg := TRegistry.Create;
myReg.OpenKeyReadOnly('Control Panel\Desktop');
myReg.WriteString('Wallpaper', WinDirWPFile);
myReg.WriteString('TileWallpaper', IntToStr(TileWP - 1));
myReg.Free;
SystemParametersInfo(SPI_SETDESKWALLPAPER, 0, WinDirWPFile, SPIF_SENDCHANGE); //chaged WallPaper
StrDispose(WinDirWPFile);
end;
SystemParametersInfo(SPI_SETDESKWALLPAPER,
0,
'c:\yourbmp.bmp',
SPIF_UPDATEINIFILE or SPIF_SENDWININICHANGE);