• Delphi学习之函数 ④扩展的文件及目录操作函数


    //▎============================================================▎//
    //▎=================④扩展的文件及目录操作函数=================▎//
    //▎============================================================▎//
    
    function MoveFile(const sName, dName: string): Boolean;  {测试通过}
    {* 移动文件、目录,参数为源、目标名}
    
    procedure FileProperties(const FName: string); {测试通过}
    {* 打开文件属性窗口}
    
    function OpenDialog(var FileName: string; Title: string; Filter: string;
      Ext: string): Boolean;
    {* 打开文件框}
    
    function FormatPath(APath: string; Width: Integer): string; {测试通过}
    {* 缩短显示不下的长路径名}
    
    function GetRelativePath(Source, Dest: string): string;  {测试通过}
    {* 取两个目录的相对路径,注意串尾不能是'\'字符!}
    
    procedure RunFile(const FName: string; Handle: THandle = 0;
      const Param: string = '');   {测试通过}
    {* 运行一个文件}
    
    function WinExecAndWait32(FileName: string; Visibility: Integer = SW_NORMAL):
      Integer; {测试通过}
    {* 运行一个文件并等待其结束}
    
    function AppPath: string; {测试通过}
    {* 应用程序路径}
    
    function GetWindowsDir: string; {测试通过}
    {* 取Windows系统目录}
    
    function GetWinTempDir: string;  {测试通过}
    {* 取临时文件目录}
    
    function AddDirSuffix(Dir: string): string;  {测试通过}
    {* 目录尾加'\'修正}
    
    function MakePath(Dir: string): string;  {测试通过}
    {* 目录尾加'\'修正}
    
    function IsFileInUse(FName: string): Boolean;   {测试通过}
    {* 判断文件是否正在使用}
    
    function GetFileSize(FileName: string): Integer;   {测试通过}
    {* 取文件长度}
    
    function SetFileDate(FileName: string; CreationTime, LastWriteTime, LastAccessTime:
      TFileTime): Boolean;     {测试通过}
    {* 设置文件时间 Example:    FileSetDate('c:\Test\Test1.exe',753160662);    }
    
    function GetFileDate(FileName: string; var CreationTime, LastWriteTime, LastAccessTime:
      TFileTime): Boolean;     {测试通过}
    {* 取文件时间}
    
    function FileTimeToLocalSystemTime(FTime: TFileTime): TSystemTime;  {测试通过}
    {* 文件时间转本地时间}
    
    function LocalSystemTimeToFileTime(STime: TSystemTime): TFileTime;  {测试通过}
    {* 本地时间转文件时间}
    
    function GetFileIcon(FileName: string; var Icon: TIcon): Boolean;   {测试通过}
    {* 取得与文件相关的图标,成功则返回True}
    
    function CreateBakFile(FileName, Ext: string): Boolean;   {测试通过}
    {* 创建备份文件}
    
    function Deltree(Dir: string): Boolean;    {测试通过}
    {* 删除整个目录}
    
    function GetDirFiles(Dir: string): Integer;    {测试通过}
    {* 取文件夹文件数}
    
    type
      TFindCallBack = procedure(const FileName: string; const Info: TSearchRec;
        var Abort: Boolean);
    {* 查找指定目录下文件的回调函数}
    
    procedure FindFile(const Path: string; const FileName: string = '*.*';
      Proc: TFindCallBack = nil; bSub: Boolean = True; const bMsg: Boolean = True);
    {* 查找指定目录下文件}
    
    procedure FindFileList(Path,Filter:string;FileList:TStrings;ContainSubDir:Boolean);
    { 功能说明:查找一个路径下的所有文件。
      参数: path:路径,filter:文件扩展名过滤,FileList:文件列表, ContainSubDir:是否包含子目录}
    
    function Txtline(const txt: string): integer;
    {* 返回一文本文件的行数}
    
    function Html2Txt(htmlfilename: string): string;
    {* Html文件转化成文本文件}
    
    function OpenWith(const FileName: string): Integer;     {测试通过}
    {* 文件打开方式}
  • 相关阅读:
    第21周六
    第21周五
    第21周四
    第21周三
    C/C++中各种类型int、long、double、char表示范围(最大最小值)
    插入排序
    面向对象的5个基本设计原则
    红黑树
    Cocos2d-x学习笔记(六) 定时器Schedule的简单应用
    SNMP协议具体解释
  • 原文地址:https://www.cnblogs.com/flay/p/2460105.html
Copyright © 2020-2023  润新知