-
通过读文件方式获得收藏夹中URL
- unit Unit1;
- interface
- uses
- Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
- Dialogs, StdCtrls, IniFiles, ShlObj;
- type
- TForm1 = class(TForm)
- btn1: TButton;
- Memo1: TMemo;
- procedure btn1Click(Sender: TObject);
- private
- public
-
- end;
- var
- Form1: TForm1;
- implementation
- {$R *.dfm}
- procedure TForm1.btn1Click(Sender: TObject);
- function GetFavoritesUrl(FavoritesFile: string): string;
- var
- MyIniFile: TInifile;
- begin
- MyIniFile := TInifile.Create(FavoritesFile);
- try
- Result := MyIniFile.ReadString('InternetShortcut', 'URL', '');
- finally
- MyIniFile.Free;
- end;
- end;
- var
- Search: TSearchRec;
- pidl: PItemIDList;
- FavPath: array[0..MAX_PATH] of char;
- FavoritesPath: string;
- i, j: Integer;
- begin
- SHGetSpecialFolderLocation(Handle, CSIDL_FAVORITES, pidl);
- SHGetPathFromIDList(pidl, @FavPath);
- FavoritesPath := Format('%s/', [FavPath]);
- Memo1.Clear;
- with Search, Memo1.Lines do
- begin
- i := FindFirst(FavoritesPath + '*.url', 0, Search);
- j := 1;
- while i = 0 do
- begin
- if (Search.Name <> '.') and (Search.Name <> '..') then
- begin
- Add(IntToStr(j) + '、' + Name);
- Add(' ' + GetFavoritesUrl(FavoritesPath + Name));
- SetLength(Name, Length(Name) - 4);
- i := FindNext(Search);
- j := j + 1;
- end;
- end;
- end;
- end;
- end.
-
相关阅读:
vue教程1-07 模板和过滤器
vue教程1-06 v-bind属性、class和style
vue教程1-05 事件 简写、事件对象、冒泡、默认行为、键盘事件
Webstorm使用教程详解
diff, cmp, patch
grep, sed, awk
which,whereis, locate, find
tar, rar, unrar, zip, unzip
groups, usermod, chown, chgrp, chmod
pwd, cd, ls, touch, mkdir, rmdir, rm
-
原文地址:https://www.cnblogs.com/zhaoshujie/p/9594848.html
Copyright © 2020-2023
润新知