ale ja wiem ze mam, podalem tylko to bo nie sadzilem ze reszta potrzebna, bo skoro w parametrach sa dwie zmienne LinkInfo i ten filename to dlaczego jak daje dwa parametry to mi blad wyskakuje ze za duzo.
to ta funkcja
function GetLinkInfo(FileName: String; var LinkInfo: TLinkInfo): Boolean;
var
sl: IShellLink;
ppf: IPersistFile;
wcLinkName: array[0..MAX_PATH] of WideChar;
sTarget, sDir, sParams, sDesc, sIcon: String;
sClsID: PItemIDList;
sHotKey: Word;
sCmdShow: Integer;
Idx: Integer;
wfd: TWin32FindData;
begin
Result := True;
FillChar(LinkInfo, SizeOf(LinkInfo), 0);
SetLength(sDesc, MAX_PATH);
SetLength(sTarget, MAX_PATH);
SetLength(sDir, MAX_PATH);
SetLength(sParams, MAX_PATH);
SetLength(sIcon, MAX_PATH);
sClsID := nil;
CoInitialize(nil); // Initialize COM
try
CoCreateInstance(CLSID_ShellLink, nil, CLSCTX_INPROC_SERVER, IID_IShellLinkA, sl);
sl.QueryInterface(IPersistFile, ppf);
MultiByteToWideChar(CP_ACP, 0, PChar(FileName), -1, wcLinkName, MAX_PATH);
ppf.Load(wcLinkName, STGM_READ);
with sl do
begin
GetPath(PChar(sTarget), MAX_PATH, wfd, SLR_ANY_MATCH);
GetIDList(sClsID);
GetDescription(PChar(sDesc), MAX_PATH);
GetWorkingDirectory(PChar(sDir), MAX_PATH);
GetArguments(PChar(sParams), MAX_PATH);
GetIconLocation(PChar(sIcon), MAX_PATH, Idx);
GetHotkey(sHotKey);
GetShowCmd(sCmdShow);
end;
except
on EOleSysError do
Result := False;
end;
CoUninitialize;
if sClsID = nil then
Result := False
else
begin
SetLength(sTarget, StrLen(PChar(sTarget)));
SetLength(sDir, StrLen(PChar(sDir)));
SetLength(sDesc, StrLen(PChar(sDesc)));
SetLength(sParams, StrLen(PChar(sParams)));
SetLength(sIcon, StrLen(PChar(sIcon)));
LinkInfo.Target := sTarget;
// Target is empty if the link references a virtual folder, like My Computer
LinkInfo.ClsID := sClsID; // ClsID is always absolute
LinkInfo.WorkDir := sDir;
LinkInfo.Description := sDesc;
LinkInfo.Parameters := sParams;
if StrLen(PChar(sIcon)) <> 0 then
LinkInfo.IconPath := sIcon
else
LinkInfo.IconPath := sTarget;
LinkInfo.IconIndex := Idx;
LinkInfo.HotKey := sHotKey;
LinkInfo.ShowState := CmdShowToShowState(sCmdShow);
end;
end;