je comprend pas tellement pourquoi FindFirst et FindNext avec des
arguments comme 'c:\*.*' arrête de fonctionner si j'enlève la coche suivante:
Quelqu'un peut m'expliquer?
On peut tester facilement avec le code du help:
Si il existe une alternative à FindFirst FindNext et qui fonctionnerais
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51 procedure TForm1.Button1Click(Sender: TObject); var sr: TSearchRec; FileAttrs: Integer; begin StringGrid1.RowCount := 1; if CheckBox1.Checked then FileAttrs := faReadOnly else FileAttrs := 0; if CheckBox2.Checked then FileAttrs := FileAttrs + faHidden; if CheckBox3.Checked then FileAttrs := FileAttrs + faSysFile; if CheckBox4.Checked then FileAttrs := FileAttrs + faVolumeID; if CheckBox5.Checked then FileAttrs := FileAttrs + faDirectory; if CheckBox6.Checked then FileAttrs := FileAttrs + faArchive; if CheckBox7.Checked then FileAttrs := FileAttrs + faAnyFile; if FindFirst(Edit1.Text, FileAttrs, sr) = 0 then begin with StringGrid1 do begin if (sr.Attr and FileAttrs) = sr.Attr then begin Cells[1,RowCount-1] := sr.Name; Cells[2,RowCount-1] := IntToStr(sr.Size); end; while FindNext(sr) = 0 do begin if (sr.Attr and FileAttrs) = sr.Attr then begin RowCount := RowCount + 1; Cells[1, RowCount-1] := sr.Name; Cells[2, RowCount-1] := IntToStr(sr.Size); end; end; FindClose(sr); end; end; end;
même si cette case est décoché ca m'arrangerais beaucoup....
Merci
Partager