Program Manager; {$X+} Uses DOS,Objects,App,Views,Dialogs,Drivers,MsgBox; const dirattr : set of byte=[$10..$14]; label la; var S:SearchRec; L,G: PStringCollection; {Collection of file names} Foc: String; {Select File} put:string; type TMyApp = object (TApplication) Procedure Run; Virtual; Procedure HandleEvent(var Event:TEvent); Virtual; Destructor Done; Virtual; end; PMyListBox = ^TMyListBox; TMyListBox = object (TListBox) Function Valid(Command:Word):boolean; Virtual; end; {----------------------} Procedure poiskfailov; Begin put:='C:\'; put:=put+Foc; {Пытался реализовать так} L:=New (PStringCollection,Init(50,10)); FindFirst(put+'*.*',directory,S); While DosError = 0 do with S,L^ do begin if s.attr in dirattr then Insert(NewStr(Name)); FindNext(S); end; G:=New (PStringCollection,Init(50,10)); FindFirst(put+'*.*',directory,S); While DosError = 0 do with S,G^ do begin if (s.attr <> $10) and (s.attr <> $11) and (s.attr <> $12) and (s.attr <> $13) and (s.attr <> $14) then Insert(NewStr(Name)); FindNext(S); end; End; {-----------------------------} {----------------------------} Procedure TMyApp.Run; var R,RR,X,Y:TRect; W:PDialog; B,I:PScrollBar; P,M:PListBox; fl:boolean; begin repeat schet:=0; poiskfailov; R.Assign(1,1,77,44); W:=New (PDialog,Init(R,'Directories Files in Directory')); with W^ do begin RR.Assign(36,1,37,42); B:=New (PScrollBar,Init(RR)); Insert(B); Y.Assign(75,1,76,42); I:=New (PScrollBar,Init(Y)); Insert(I); R.Assign (1,1,36,42); P:=New (PMyListBox,Init (R,1,B)); P^.NewList(L); Insert(P); X.Assign (37,1,75,42); M:=New (PMyListBox,Init (X,1,I)); M^.NewList(G); Insert(M); end; DeskTop^.Insert(W); Inherited Run; schet:=schet+1; until fl; end; {-----------------------------------} Procedure TMyApp.HandleEvent(var Event:TEvent); begin Inherited HandleEvent(Event); If Event.What = evKeyDown then if Event.KeyCode=13 then begin put:=put+Foc; poiskfailov; end else exit; ClearEvent(Event); end; {------------------------} Function TMyListBox.Valid; begin Foc:=PString (L^.At(Focused))^; Valid:=True; end; {--------------------------} Destructor TMyApp.Done; var R:TRect; stro:string; begin R.Assign(20,15,60,22); MessageBoxRect(R,#3'Select File'+Foc,NIL,$402); Inherited Done; end; {-------------------------------} var P: TMyApp; begin P.Init; P.Run; P.Done; end.