Quelq'un peut-il me dire pourquoi quand j'ajoute l'unit windows ça beugue ?

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
52
53
54
55
 
{ --------------------------------------------------------------------------------------------------------------------
                                   Unité globale
  -------------------------------------------------------------------------------------------------------------------- }
 
  unit agProcs;
 
  interface
 
  uses
    Menus, Forms, StdCtrls, SysUtils, windows(houla! :o);
 
  type
    TgProcs = class(TObject)
    procedure FindDir(gDirectory: string; var AListBox: TListBox);
    procedure FileNameWithoutExt(gDirectory: string; var AListBox:Tlistbox);
  end;
 
  implementation
 
  uses
    aMenu;
 
  procedure TgProcs.FindDir(gDirectory: string; var Alistbox:Tlistbox );
  var
    SearchRec: TSearchRec;
    i: Cardinal;
  begin
    Alistbox.Clear;
    i := FindFirst(gDirectory + '\*.*', faAnyFile, SearchRec);
    while i = 0 do
      begin
        if ((SearchRec.Attr and faDirectory > 0) and (SearchRec.Name <> '.') and (SearchRec.Name<>'..')) then
          Alistbox.Items.Add(SearchRec.Name);
          i := Findnext(SearchRec);
      end;
      FindClose(SearchRec);
  end;
 
  procedure TgProcs.FileNameWithoutExt(gDirectory: string; var AListBox:Tlistbox);
  var
    SearchRec: TSearchRec;
    i: Cardinal;
  begin
    AListBox.Clear;
    i := FindFirst(gDirectory + '\*.html', faAnyFile, SearchRec);
    while i = 0 do
      begin
        if ((faDirectory > 0) and (SearchRec.Name <> '.') and (SearchRec.Name<>'..')) then
          Alistbox.Items.Add(ChangeFileExt(SearchRec.Name, ''));
          i := Findnext(SearchRec);
      end;
      FindClose(SearchRec);
  end;
  end.
le message d'erreur qui apparait est le suivant
type incompatible "cardinal" "TSearchRec"

pour l'instant ça marche mais j'ai une fonction que je doit ajouter en globale et qui utilise l'unit windows à ce moment quand j'ajoute windows, c'est le comble non

auriez vous une explication pour ne pas dire à "ce phénomène bizare"?

Merci.