Как получить закладки IE

Советы » Браузер » Как получить закладки IE

function GetIEFavourites(const favpath: string): TStrings;
var
  searchrec: TSearchrec;
  str: TStrings;
  path, dir, filename: string;
  Buffer: array [0..2047] of Char;
  found: Integer;
begin
  str := TStringList.Create;
  //Get all file names in the favourites path
  path := FavPath + '*.url';
  dir := ExtractFilepath(path);
  found := FindFirst(path, faAnyFile, searchrec);
  while found = 0 do
  begin
    //Get now URLs from files in variable files
    SetString(filename, Buffer, GetPrivateProfileString('InternetShortcut',
      PChar('URL'), nil, Buffer, SizeOf(Buffer), PChar(dir+searchrec.name)));
    str.Add(filename);
    found := FindNext(searchrec);
  end;
  //unterordner finden
  found := FindFirst(dir + '*.*', faAnyFile, searchrec);
  while found=0 do
  begin
    if ((searchrec.Attr and faDirectory) > 0) and (searchrec.name[1] <> '.') then
      str.AddStrings(GetIEFavourites(dir + '' + searchrec.name));
    found := FindNext(searchrec);
  end;
  FindClose(searchrec);
  Result := str;
end;

procedure TForm1.Button1Click(Sender: TObject);
var
  pidl: PItemIDList;
  FavPath: array [0..MAX_PATH] of char;
begin
  SHGetSpecialFolderLocation(Handle, CSIDL_FAVORITES, pidl);
  SHGetPathFromIDList(pidl, favpath);
  ListBox1.Items := GetIEFavourites(StrPas(FavPath));
end;

Другое по теме:

Категории

Статьи

Советы

Copyright © 2022 - All Rights Reserved - www.delphirus.com