uses Shlobj, ActiveX, shellapi;
function ProgrammOrdner: string;
var
pidl: PItemIDList;
Pfad: PChar;
Malloc: IMalloc;
begin
result := '';
SHGetMalloc(Malloc);
if Malloc = nil then
exit;
if SHGetSpecialFolderLocation(0, CSIDL_PROGRAM_FILES, pidl) = NOERROR then
begin
Pfad := StrAlloc(max_path);
if SHGetPathFromIDList(pidl, Pfad) then
begin
result := Pfad;
if ansilastchar(result) <> '\' then
result := result + '\';
end;
StrDispose(Pfad);
Malloc.Free(pidl);
end;
end;
procedure FotoView(bilddatei: string);
begin
if not fileexists(bilddatei) then
raise Exception.Create('Bild nicht gefunden.');
ShellExecute(application.Handle, PChar('open'), PChar('rundll32.exe'),
PChar('"' + ProgrammOrdner +
'Windows Photo Viewer\PhotoViewer.dll",ImageView_Fullscreen ' +
bilddatei), nil, SW_NORMAL);
end;
// Beispielaufruf
procedure TForm1.Button1Click(Sender: TObject);
begin
FotoView('C:\Windows\Web\Wallpaper\Nature\img2.jpg');
end;