本文整理自网络,侵删。
uses ShlObj, ShellAPI;
function GetSpecialPath(CSIDL: word): string; var s: string;begin SetLength(s, MAX_PATH); if not SHGetSpecialFolderPath(0, PChar(s), CSIDL, true) then s:=''; Result:=PChar(s);end;
procedure TForm1.FormCreate(Sender: TObject);begin ShellExecute(0,'open','cmd.exe',Pchar('/c rundll32 "'+GetSpecialPath($26)+'\Windows Photo Viewer\PhotoViewer.dll",ImageView_Fullscreen C:\Users\haokucn\Desktop\QQ图片20191012161522.png'),nil,SW_HIDE);
end;
相关阅读 >>
Delphi pchar和array [0..255] of char的区别
更多相关阅读请进入《Delphi》频道 >>