Четверг, 17.07.2025, 19:19
Приветствую Вас Гость | RSS
delphicode.clan.su
Форма входа
Поиск
Статистика

Онлайн всего: 1
Гостей: 1
Пользователей: 0
 
 ПОЛУЧИТЬ СПИСОК WEB-АДРЕСОВ ПАПКИ ИЗБРАННОЕ В IE
  
 В USES необходимо включить модуль ShlObj
 Функция:
 
function GetIEFavorites(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;
 found:=FindFirst(dir+'\*.*',faAnyFile,searchrec);
 while found=0 do
 begin
 if ((searchrec.Attr and faDirectory) > 0) and
 (searchrec.Name[1]<>'.') then
 str.AddStrings(GetIEFavorites(dir+'\'+searchrec.name));
 found := FindNext(searchrec);
 end;
 FindClose(searchrec);
 Result:=str;
end;
  
 Использование. Поместим на форму TButton и TListBox:
 
procedure TForm1.Button1Click(Sender: TObject);
var pidl: PItemIDList;
FavPath: array[0..MAX_PATH] of char;
begin
//get the favorites folder
SHGetSpecialFolderLocation(Handle, CSIDL_FAVORITES, pidl);
SHGetPathFromIDList(pidl, favpath);
ListBox1.Items:=GetIEFavorites(StrPas(FavPath));
end;