unit treeview;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ComCtrls, StdCtrls, FileCtrl;
type
TfrmMain = class(TForm)
DriveComboBox1: TDriveComboBox;
dirlst: TDirectoryListBox;
tv: TTreeView;
procedure DLBChange(Sender: TObject);
private
{ Private declarations }
procedure myfind(Bnode:TTreeNode);
public
{ Public declarations }
end;
var
frmMain: TfrmMain;
directorynote,filenode:TTreeNode;
implementation
{$R *.dfm}
procedure TfrmMain.DLBChange(Sender: TObject);
begin
tv.Items.Clear;
myfind(directorynote);
end;
procedure TfrmMain.myfind(Bnode: TTreeNode);
var
sr:TSearchRec;
Err:Integer;
begin
Err := FindFirst('*.*',$37,sr);
while(Err=0)do
begin
if(sr.Name[1]<>'.')then
begin
if(sr.Attr and faDirectory)=0 then
begin
tv.Items.AddChildFirst(bnode,sr.Name);
end;
if(sr.Attr and faDirectory)=faDirectory then
begin
ChDir(sr.Name);
Application.ProcessMessages;
myfind(filenode);
ChDir('..');
end;
end;
Err :=FindNext(sr);
end;
end;
end.