Ver Mensaje Individual
  #15  
Antiguo 19-10-2005
Giniromero Giniromero is offline
Miembro
 
Registrado: may 2003
Ubicación: Madrid
Posts: 296
Reputación: 21
Giniromero Va por buen camino
Hola a todos,

El código que tengo ahora mismo al respecto es el siguiente:


Código Delphi [-]
procedure TFrmFxMain.SpeedButton20Click(Sender: TObject);
var xpath: tStringList;
    subcarpetas : TStringList;
    cFile : String;
    str : string;
    i: integer;

begin

  TRY

    xpath := TStringList.create;
    cFile := 'c:\_Fx\FileLocation.ini';


    If Fileexists( cFile ) Then Begin

      xpath.LoadFromFile(cFile);

      TrY

         IF (xpath[1] <> '') THEN BEGIN

           try

             subcarpetas:= TStringList.Create;
             ListFileDir(xpath[1], subcarpetas);

             iF Pos(FrmDModule.TbAlumnosNUMALU.AsString, subcarpetas[i])<>0 tHEN bEGIN

                shellexecute(self.Handle, PChar('open'), PChar('explorer.exe'), PChar(subcarpetas[i]), nil, SW_SHOWNORMAL);

             eND
             eLSE bEGIN

                 Showmessage('No hay carpeta para este alumno');

             eND;

           finally
             subcarpetas.Free;
           end;

        END;

      ExcepT
        on E: Exception do begin
         str := 'Error al leer Archivo "FileLocation.ini" para caja. Faltan datos o vacio. Mensaje de error : ' + E.Message;
         Application.MessageBox(PChar(str), 'Atención', MB_OK);
         Application.Terminate;
        end;
      EnD;

    End
    Else Begin

      showmessage ('No se encuentra el archivo "FileLocation.ini" en la ruta especificada');

    End;


  FINALLY

    xpath.Free;

  END;


end;

procedure ListFileDir(Path: string; FileList: TStrings);
var SR: TSearchRec;
begin

    if (FindFirst(Path + '*.*', faAnyFile, SR) = 0) then begin
      repeat
       if (SR.Attr = faDirectory) then begin
           FileList.Add(SR.Name);
       end;
     until (FindNext(SR) <> 0);
      FindClose(SR);
   end;

end;


Si pongo "FindClose(SR);" como comentado, me encuentro que el error me salta en:
Código Delphi [-]
 procedure ListFileDir(Path: string; FileList: TStrings);

y me dice que:
Código:
[Error] Fxmain.pas(467): Unsatisfied forward or external declaration: 'TFrmFxMain.ListFileDir'
si no pongo el comentario, el error salta directamente en la línea en la que está el findClose, y me dice al compilar que:

Código:
[Error] Fxmain.pas(3414): Incompatible types: 'Cardinal' and 'TSearchRec'


Alguien puede echarle un vistazo al código, por que yo no veo donde puede estar el problema.

Gracias,

Virginia
__________________
Sonrie al mundo, y el mundo te sonreirá :)
Responder Con Cita