Ver Mensaje Individual
  #3  
Antiguo 13-11-2005
[Gunman] [Gunman] is offline
Miembro
 
Registrado: dic 2004
Ubicación: Pedreguer.
Posts: 355
Reputación: 22
[Gunman] Va por buen camino
Lepe, he usado tu función (un poco modificada) y en todos los items me devuelve 0 como valor. Aquí pongo la función:
Código Delphi [-]
 function GetFileSize(FileName: String): Int64;
   function IsFolder(Folder: String): Boolean;
   var
     Attributes:Word;
   begin
     Attributes:=FileGetAttr(Folder);
     Result:=(Attributes and faDirectory)=faDirectory;
   end;
 
   function AbsoluteValue(Value: Real): Real;
   begin
     if Value < 0 then
     Result := -(Value)
     else
     Result := Value;
   end;
 var
   Srec: TSearchRec;
   Size: Real;
 begin
   if FindFirst(FileName,faAnyFile and not faSysFile or faHidden, Srec) <> 0 then
     Result := Srec.FindData.nFileSizeHigh *MAXDWORD +
   Srec.FindData.nFileSizeLow
   else
      Result := 0;
   FindClose(Srec);
 end;

Bueno, por si te sirve de algo también te pongo el código de llamada a la función:
Código Delphi [-]
 procedure TMainFrm.LcListData(Sender: TObject; Item: TListItem);
 var
   FInfo: TSHFileInfo;
 begin
   Item.Caption := FileList[Item.Index];
 
   Item.SubItems.Add(IntToStr(GetFileSize(IncludeTrailingPathDelimiter(CDirLCCB.Text)+
                 Item.Caption)));
 
   SHGetFileInfo(PAnsiChar(IncludeTrailingPathDelimiter(CDirLCCB.Text)+
                 Item.Caption),0,FInfo,SizeOf(FInfo),SHGFI_TYPENAME);
 
   Item.SubItems.Add(FInfo.szTypeName);
 end;
__________________
l2prog.co.nr
Responder Con Cita