|
- procedure TForm1.Button1Click(Sender: TObject);
- var
- //   Searcher: TFileReader;
-   Info : TSearchRec;
-   Count : Longint;
-   app: string;
- begin
-      Count:=0;
-      //se volessi leggere la cartella corrente basterebbe *
-      If FindFirst ('c:\*',faAnyFile and faDirectory,Info)=0 then
-        begin
-        Repeat
-          Inc(Count);
-          With Info do
-            begin
-            If (Attr and faDirectory) = faDirectory then
-              Form1.Lista_File.Items.Add('Dir : ' + Name + ' dimensione: ' + IntToStr(Size))
-            else
-             Form1.Lista_File.Items.Add('File : ' + Name + ' dimensione: ' + IntToStr(Size));
-          end;
-        Until FindNext(info)<>0;
-        end;
-      FindClose(Info);
-      //Writeln ('Finished search. Found ',Count,' matches');
-      Form1.Lista_File.Items.Add('Finished search. Found ' + IntToStr(Count) + ' matches');
- end;
- //to control the drive
- procedure TForm1.Button2Click(Sender: TObject);
- begin
-      if DirectoryExists('C:')=TRUE then
-      begin
-           ShowMessage('Il drive C: esiste!');
-      end;
-      if DirectoryExists('E:')=TRUE then
-      begin
-           ShowMessage('Il drive E: esiste!');
-      end;
- end;     
复制代码 |
|