Ich meine das funktioniert so:
Delphi-Quellcode:
function ChangeWallpaper_AD(aFile: String): Boolean;
const
CLSID_ActiveDesktop: TGUID = '{75048700-EF1F-11D0-9888-006097DEACF9}';
var
hObj: IUnknown;
ADesktop: IActiveDesktop;
str: string;
wstr: PWideChar;
begin
hObj := CreateComObject(CLSID_ActiveDesktop);
ADesktop := hObj as IActiveDesktop;
wstr := AllocMem(MAX_PATH);
try
StringToWideChar(aFile, wstr, MAX_PATH);
ADesktop.SetWallpaper(wstr, 0);
ADesktop.ApplyChanges(AD_APPLY_ALL or AD_APPLY_FORCE);
finally
FreeMem(wstr);
end;
end;
Nur bin ich mir gerade nicht sicher, ob das JPEG's unterstützt, glaube aber schon.