求教如何在下拉菜单中显示收藏夹内容(50分)

  • 主题发起人 主题发起人 violet1011
  • 开始时间 开始时间
V

violet1011

Unregistered / Unconfirmed
GUEST, unregistred user!
请教高手指导如何实现
 
用FindFirst/Findnext/FindClose
查找收葳夹目录下的所有的lnk文件,是一个ini文件,读出其中的url,然后显示文件名就行了.
 
谢谢指教,
小弟初学delphi,不懂怎么用
 
获取IE收藏夹内容
Helmut Dollinger


摘 要:如何从MSIE递归的读取保存的URL!
关键字:Internet-Explorer 收藏夹
类 别:网络



中文开发在线原创作品,未经允许,严禁任何形式的转载



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;
//取在favourites 路径下的所有名字
path:=FavPath+'/*.url';
dir:=ExtractFilepath(path);
found:=FindFirst(path,faAnyFile,searchrec);
while found = 0 do
begin
//从files变量读URLs
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;

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:=GetIEFavorites(StrPas(FavPath));
end;

投稿人:CoDelphi.com 投稿日期:2001-5-19 14:57:00
 
有控件,需要请联系zzy9903@163.com
 
后退
顶部