GetFileSize() 得到文件大小

 
{得到文件的大小 KB}

//调用 返回值:=GetFileSize(application.ExeName);

function GetFileSize(const FileName: string): string;
var
  SR: TSearchRec;
begin
  Result := '-1';
  if FindFirst(FileName, faAnyFile and (not faDirectory), SR) = 0 then
  try
    Result := format('%d KB',[SR.Size div 1024]);
  finally
    FindClose(SR);
  end;
end;





posted @ 2012-07-26 08:49  XE2011  阅读(1230)  评论(0编辑  收藏  举报