Mam shelllistobject i w nim otwarty folder historii odwiedzanych stron. I problem jest taki, że ine da się odczytać adresu z żadnego skrótu jeśli folder to historia.
Tak wygląda część tego kodu:
uses: inifiles
function LnkPath(Plik:WideString):string;
var
MyObj : IUnknown;
MyLnk : IShellLink;
MyPf : IPersistFile;
ok : TWin32FindData;
Path : array [0..255] of char;
begin
MyObj := CreateComObject(CLSID_ShellLink);
MyLnk := MyObj as IShellLink;
MyPf := MyObj as IPersistFile;
MyPf.Load(PWideChar(Plik),fmOpenRead);
MyLnk.GetPath(Path, 255, ok, 0);
Result:=Path;
end;
procedure TOkno.ShellTreeView1Click(Sender: TObject);
var
ini: TIniFile;
begin
if ShellTreeView1.Path <> '' then
if FileExists(ShellTreeView1.Path) then
begin
if LnkPath(ShellTreeView1.Path) <> '' then
WebBrowser1.Navigate(LnkPath(ShellTreeView1.Path));
if LnkPath(ShellTreeView1.Path) = '' then
begin
ini:=TIniFile.Create(ShellTreeView1.Path);
try
WebBrowser1.Navigate(ini.ReadString('InternetShortcut', 'url', ''));
finally
ini.Free
end;
end;
end;
end;
i co mam zrobić, żeby odczytać skrót z pliku w histori?