Buscar

Como pegar a lista de favoritos do internet explorer?

Código

Function GetIEFavoritos(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;
  //Pega todos os nomes de arquivo no path dos favoritos
  path:=FavPath+'*.url';
  dir:=ExtractFilepath(path);
  found:=FindFirst(path,faAnyFile,searchrec);
  while found=0 do begin
  SetString(filename, Buffer, GetPrivateProfileString('InternetShortcut',
  PChar('URL'), NIL, Buffer, SizeOf(Buffer), PChar(dir+searchrec.Name)));
  str.Add(filename);
  found:=FindNext(searchrec);
 end;
 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:= GetIEFavoritos (StrPas(FavPath));
end;  

Publicidade

Vote na dica




Quantidade de votos: 0 votos
Aceitação: 0%


Detalhes da dica

Categoria: Windows
Adicionada dia: 06/06/03
Por: Felipe Monteiro
Visualizada: 2392 vezes

Planeta Delphi - Tudo sobre programação Delphi Planeta Delphi - www.planetadelphi.com.br - Todos os direitos reservados | Copyright 2001-2009