想做一个能代替收藏夹的小工具。
功能:
点击一个按钮,导出收藏夹里的所有网址,在列表框中排列整齐,并且点击可以链接到相关网页。希望提供代码或思路,谢谢!

解决方案 »

  1.   

    只知道是写在C:\Documents and Settings\Administrator\Favorites文件夹下的,一些url的快捷方式.
      

  2.   

    在C:\Documents and Settings\Administrator\中有个“收藏夹”文件夹,你可以把其中的文件名称拷贝出来,并对文件名建立连接就可以了
      

  3.   

    收藏夹路径要从注册表读,用TRegistry.ReadString
    路径:HKEY_CURRENT_USER\Software\MicroSoft\Windows\CurrentVersion\Explorer\Shell Folders\Favorites
    枚举文件用FindFirst FindNext,注意文件夹下面可能还有文件夹,比如"链接", 所以一个TListBox处理不了这样层次关系,用TTreeView或者TMainMemu
    打开网页用ShellExecute就可以了
      

  4.   


    unit MainFrm;interfaceuses
      Windows, Messages, SysUtils, Classes, Graphics, Controls,
      Forms, Dialogs, StdCtrls,shellapi;type
      TMainForm = class(TForm)
        btnSearchForFiles: TButton;
        lbox: TListBox;
        Button1: TButton;
        procedure btnSearchForFilesClick(Sender: TObject);
        procedure lboxMouseDown(Sender: TObject; Button: TMouseButton;
          Shift: TShiftState; X, Y: Integer);
      private
        function GetDirectoryName(Dir: String): String;
        procedure FindFiles(APath: String);
      end;var
      MainForm: TMainForm;implementation{$R *.DFM}function TMainForm.GetDirectoryName(Dir: String): String;
    begin
      if Dir[Length(Dir)]<> '\' then
        Result := Dir+'\'
      else
        Result := Dir;
    end;procedure TMainForm.FindFiles(APath: String);
    var
      FSearchRec,
      DSearchRec: TSearchRec;
      FindResult: integer;  function IsDirNotation(ADirName: String): Boolean;
      begin
        Result := (ADirName = '.') or (ADirName = '..');
      end;begin
      APath := GetDirectoryName(APath);
      FindResult := FindFirst(APath+'*.*',faAnyFile+faHidden+
                              faSysFile+faReadOnly,FSearchRec);
      try
        while FindResult = 0 do
        begin
          lbox.Items.Add(LowerCase(APath+FSearchRec.Name));
          FindResult := FindNext(FSearchRec);
        end;    FindResult := FindFirst(APath+'*.*', faDirectory, DSearchRec);    while FindResult = 0 do
        begin
          if ((DSearchRec.Attr and faDirectory) = faDirectory) and not
            IsDirNotation(DSearchRec.Name) then
            FindFiles(APath+DSearchRec.Name);
          FindResult := FindNext(DSearchRec);
        end;
      finally
        FindClose(FSearchRec);
      end;
    end;procedure TMainForm.btnSearchForFilesClick(Sender: TObject);
    begin
        FindFiles('C:\Documents and Settings\Administrator\Favorites');
    end;
    procedure TMainForm.lboxMouseDown(Sender: TObject; Button: TMouseButton;
      Shift: TShiftState; X, Y: Integer);
    begin
      ShellExecute(Handle,'open',pchar(lbox.Items[y]),nil,nil,SW_SHOWNORMAL);
    end;end.
      

  5.   

    非常感谢yuqianyi1974 为我提供了完整的代码,基本上是直接可用的。
    只是这一句执行的时候总是会出错:
    ShellExecute(Handle,'open',pchar(lbox.Items[y]),nil,nil,SW_SHOWNORMAL);还望解答一下,谢谢!
      

  6.   

    ShellExecute(Handle,'open',pchar(lbox.Items[lbox.ItemIndex]),nil,nil,SW_SHOWNORMAL);