如何讀出收藏夾裏的地址? |
答題得分者是:hagar
|
hcker
中階會員 發表:95 回覆:118 積分:62 註冊:2003-02-09 發送簡訊給我 |
|
hagar
版主 發表:143 回覆:4056 積分:4445 註冊:2002-04-14 發送簡訊給我 |
|
hcker
中階會員 發表:95 回覆:118 積分:62 註冊:2003-02-09 發送簡訊給我 |
|
hagar
版主 發表:143 回覆:4056 積分:4445 註冊:2002-04-14 發送簡訊給我 |
unit Unit6; interface uses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, ShlObj; type TForm1 = class(TForm) Button1: TButton; ListBox1: TListBox; procedure Button1Click(Sender: TObject); private { Private declarations } public { Public declarations } end; var Form1: TForm1; implementation {$R *.DFM} 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; end.--- --<-<-<@ |
本站聲明 |
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。 2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。 3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇! |