Gallery
Software
Music
Programming
Archive
Wednesday, Apr 24 Week 17

Get LNK-shortcut information

uses
windows,shellApi,comObj,shlObj,activeX;

type
TPathStr = array[byte] of ansiChar;

function getLnkShortcut(aFileName:string;out aFile,aArgu:string):boolean;
var
s :TPathStr;
wfs :TWin32FindDataA;
psl :iShellLinkA;
ppf :iPersistFile;
begin
result:=false;
aFile:='';
aArgu:='';
if coCreateInstance(CLSID_SHELLLINK,nil,CLSCTX_INPROC_SERVER,iShellLinkA,psl)=NOERROR then
if psl.queryInterface(iPersistFile,ppf)=NOERROR then try
ppf.load(pwChar(wideString(aFileName)),STGM_READ);
psl.getPath(@s,MAX_PATH,wfs,SLGP_UNCPRIORITY);
aFile:=s;
psl.getArguments(@s,MAX_PATH);
aArgu:=ansiString(s);
result:=true;
except end
end;

Related pages of Get LNK-shortcut information

Delphi programming
Programming
Delphi examples
Get lower case file extension