what's wrong in FindFirst lazarus / 9-Editor ---------------------------------------------------------------------- skaner1900 · 2010-10-23 18:39 procedure TForm1.FormCreate(Sender: TObject); var   SR : TSearchRec;   Found : Integer; begin   Found := FindFirst(ExtractFilePath(Application.ExeName)+'\*.*', faAnyFile, SR);   while (Found = 0) do   begin     ListBox1.Items.Add(SR.Name);     Found := FindNext(SR);   end;   FindClose(SR); //     <-------- THIS IS 49 LINE end; unit1.pas(49,15) Error: Incompatible type for arg no. 1: Got "TSearchRec", expected "LongWord" What is wrong?! and if I use array of string, i can't run application (Project project1.exe raised exception calss 'External: SIGSEGV') simplearray[found]:=SR.Name; ---------------------------------------------------------------------- theo · 2010-10-23 19:28 http://lmgtfy.com/?q=freepascal+findclose+got+TSearchRec%2C+expected+L ongInt&l=1 ---------------------------------------------------------------------- skaner1900 · 2010-10-23 20:14 it started work good when I deleted 'windows' from 'uses'... why? ---------------------------------------------------------------------- José Mejuto · 2010-10-23 20:35 Quote from: skaner1900 on October 23, 2010, 10:14:08 pmit started work good when I deleted 'windows' from 'uses'... why? Hello, Because there is a FindClose in the Windows API which expects a handle, not a TSearchRec. Do not use windows unit if you want portable programs.