delphi中 有用的函数.docVIP

  • 2
  • 0
  • 约1.07万字
  • 约 9页
  • 2018-01-04 发布于河南
  • 举报
delphi中 有用的函数

uses FileCtrl; private { Private declarations } FFileName: string; //得到路径。 function GetPath: string; //获得目录名称。 function GetDirectoryName(Dir: string): string; procedure FindFiles(aPath: string); //磁盘检查 function CheckDisk(Drive: Byte; aSize: Int64): Boolean; //检查目录的大小 function CheckFileSize(aPath: string): Int64; //检查备份文件是否存在,不存在或存在按 确定 返回“真” function CheckFileExists(aFileNameString: string): Boolean; public { Public declarations } end; var FormBackUp: TFormBackUp; IsClickStop: Boolean = False;//按‘取消’按钮时返回‘真’。 DirectorySize: Int64;//文件夹大小。 implementation {$R *.DFM} const a1 = 系统已经完成对记录“ ; a2 = ”的备份。是否将记录“ ; a3 = ”删除? ; function TFormBackUp.GetPath: string; begin if RbAlias.Checked then begin if cbAlias.Text = then raise Exception.Create( 请选择别名。 ); Result := D:\aaa\ + CbAlias.Text; end else if RbFlolder.Checked then Result := edPath.Text else Result := ; if Result = then raise Exception.Create( 您没有选择路径! ); if not DirectoryExists(Result) then raise Exception.CreateFmt( 文件夹 “%s”不存在。 , [Result]); end; function TFormBackUp.CheckFileSize(aPath: string): Int64; begin DirectorySize := 0; try Screen.Cursor := crHourGlass; FFileName := *.* ; FindFiles(aPath); Result := DirectorySize; Result := Result div 5; finally Screen.Cursor := crDefault; end; end; function TFormBackUp.GetDirectoryName(Dir: string): string; begin if Dir[Length(Dir)] \ then Result := Dir + \ else Result := Dir; end; procedure TFormBackUp.FindFiles(aPath: string); var FSe

文档评论(0)

1亿VIP精品文档

相关文档