Busca igual ao do windows?Alguem tem o codigo fonte?

10/12/2003

1

Quem tem um sistema parecido com o aplicativo de busca igual ao do windows?
Alguem tem o codigo fonte para poder me enviar?
Obrigado!
ASS:
JJ_Malka.


Responder

Posts

10/12/2003

Rodrigo_rcp

igual não é mas...


public 
    procedure AddFilesToList (Filter, Folder: string; Recurse: Boolean); 
  end; 

var 
  Form1: TForm1; 

implementation 

{$R *.dfm} 


procedure GetSubDirs (Folder: string; sList: TStringList); 
var 
  sr: TSearchRec; 
begin 
  if FindFirst (Folder + ´*.*´, faDirectory, sr) = 0 then 
  try 
    repeat 
      if (sr.Attr and faDirectory) = faDirectory then 
        sList.Add (sr.Name); 
    until FindNext(sr) <> 0; 
  finally 
    FindClose(sr); 
  end; 
end; 


procedure TForm1.AddFilesToList(Filter, Folder: string; Recurse: Boolean); 
var 
  sr: TSearchRec; 
  sDirList: TStringList; 
  i: Integer; 
begin 
  if FindFirst (Folder + Filter, faAnyFile, sr) = 0 then 
  repeat 
    lbFiles.Items.Add (Folder + sr.Name); 
  until FindNext(sr) <> 0; 
  FindClose(sr); 
  if Recurse then 
  begin 
    sDirList := TStringList.Create; 
    try 
      GetSubDirs (Folder, sDirList); 
      for i := 0 to sDirList.Count - 1 do 
        if (sDirList[i] <> ´.´) and (sDirList[i] <> ´..´) then 
        begin 
          Application.ProcessMessages; 
          AddFilesToList (Filter, 
            IncludeTrailingPathDelimiter (Folder + sDirList[i]), 
            Recurse); 
        end; 
    finally 
      sDirList.Free; 
    end; 
  end; 
end; 



Responder