So sieht das ganze für den Dateityp "*.jpg" aus (Beispiel):
Delphi-Quellcode:
var LoadingFile:String; MyJPEG:TJPEGImage; MyBMP:TBitmap;
begin
LoadingFile:=ListBox1.Items.Strings[ListBox1.ItemIndex];
if extractfileext(LoadingFile)='.jpg' then begin
MyJPEG:=TJPEGImage.Create;
With MyJPEG Do Begin
LoadFromFile(LoadingFile);
MyBMP := TBitmap.Create;
With MyBMP Do Begin
Width := MyJPEG.Width;
Height := MyJPEG.Height;
Canvas.Draw(0,0,MyJPEG);
SaveToFile(GAD+'DCWallpaper.bmp');
Free;
end;
end;
if not SystemParametersInfo(SPI_SETDESKWALLPAPER,
0,
PChar(GAD+'DCWallpaper.bmp'),
SPIF_SENDCHANGE OR SPIF_UPDATEINIFILE) then
RaiseLastOSError;
end;
Was müsste ich da wie verbessern?