Ver Mensaje Individual
  #4  
Antiguo 25-11-2005
Avatar de jhonny
jhonny jhonny is offline
Jhonny Suárez
 
Registrado: may 2003
Ubicación: Colombia
Posts: 7.058
Reputación: 30
jhonny Va camino a la famajhonny Va camino a la fama
Segun el truco 351 de trucomania es asi:

Código Delphi [-]
procedure TForm1.Button1Click(Sender: TObject);
 
  function GetDirectorySize(const ADirectory: string): Integer;
  var 
    Dir:  TSearchRec;
    Ret:  integer;
    Path: string;
  begin 
    Result := 0;
    Path   := ExtractFilePath(ADirectory);
    Ret    := Sysutils.FindFirst(ADirectory, faAnyFile, Dir);
 
    if Ret <> NO_ERROR then 
      exit;
 
    try
      while ret=NO_ERROR do 
      begin 
        inc(Result, Dir.Size);
        if (Dir.Attr in [faDirectory]) and (Dir.Name[1] <> '.') then 
           Inc(Result, GetDirectorySize(Path + Dir.Name + '\*.*'));
        Ret := Sysutils.FindNext(Dir);
      end; 
    finally
      Sysutils.FindClose(Dir);
    end; 
  end; 
 
 
begin 
  Caption:=IntToStr( GetDirectorySize('c:\delphi3') );
end;

Si lo asignas a Caption como esta en la funcion aprecera en la barra de titulo del formulario.

Nota: Por favor no vuelvas a repetir hilos.
espero te sirva .
__________________
Lecciones de mi Madre. Tema: modificación del comportamiento, "Pará de actuar como tu padre!"

http://www.purodelphi.com/
http://www.nosolodelphi.com/
Responder Con Cita