1、返回文件扩展名
function ExtractFileExt(const FileName: string): string;
2、返回文件名
function ExtractFileName(const FileName: string): string;
返回应用程序的文件名
function ExtractFileName(ParamStr(0)): string;
返回应用程序的路径
function ExtractFilePath(ParamStr(0)): string;
3、检测文件是否存在
function FileExists: Boolean;
(***本文出处:南山古桃(nsgtao)的百度空间:hi.baidu/nsgtao/ ****)
4、查目录中是否存在某一文件
function FileSearch(const Name, DirList: string): string;
5、返回路径名
function ExpandFileName(const FileName: string): string;
6、返回文件大小
function FileSize(var F): Integer;
7、返回上上一次I/O操作的状态
function IOResult: Integer;
8、返回文件属性
function FileGetAttr(const FileName: string): Integer;
9、设置文件属性
function FileSetAttr(const FileName: string; Attr: Integer): Integer;
10、设置文件的DOS日期戳
On Windows:
function FileSetDate(Handle: Integer; Age: Integer): Integer; overload;
Cross-platform:delphi trunc函数
function FileSetDate(const FileName: string; Age: Integer): Integer; overload;
(***本文出处:南山古桃(nsgtao)的百度空间:hi.baidu/nsgtao/ ****)
11、返回文件的DOS日期戳
function FileGetDate(Handle: Integer): Integer;
12、把Delphi日期格式转化为DOS日期格式
function DateTimeToFileDate(DateTime: TDateTime): Integer;
13、把DOS日期格式转化为Delphi日期格式
function FileDateToDateTime(FileDate: Integer): TDateTime;
14、 修改文件扩展名
function ChangeFileExt(const FileName, Extension: string): string;
15、删除文件
function DeleteFile(const FileName: string): Boolean; (SysUtils)
16、打开文件
function FileOpen(const FileName: string; Mode: LongWord): Integer;(SysUtils)返回为文件句柄
打开模式:fmOpenRead fmOpenWrite fmOpenReadWrite fmShareCompat fmShareExclusive fmShareDenyWrite fmShareDenyRead fmShareDenyNone
17、把光标定位到某一点
function FileSeek(Handle, Offset, Origin: Integer): Integer; overload;
function FileSeek(Handle: Integer; const Offset: Int64; Origin: Integer): Int64; overload;
Offset为偏移量
Origin为开始模式
Origin Action
0 The file pointer is positioned Offset bytes from the beginning of the file.
1 The file pointer is positioned Offset bytes from its current position.
2 The file pointer is positioned Offset bytes from the end of the file.
18、把文件读到缓冲区
function FileRead(Handle: Integer; var Buffer; Count: Integer): Integer;
19、关闭文件
procedure FileClose(Handle: Integer);
use增加shellapi声明
ShellExecute(handle,'open','c:\','-s','',SW_SHOWNORMAL);
第一个参数为父窗口句柄;
第二个参数为打开方式(OPEN,PRINT两种);
第三个参数为执行文件全路径;
第四个参数为
执行文件参数;
第五个参数为执行文件开始运行时的初始目录;
第六个参数为为执行文件运行方式(SW_HIDE,SW_MAXIMIZE,SW_MINIMIZE,
SW_RESTORE,SW_SHOW,SW_SHOWDEFAULT,SW_SHOWMAXIMIZED,SW_SHOWMINIMIZED,
SW_SHOWMINNOACTIVE,SW_SHOWNA,SW_SHOWNOACTIVATE,SW_SHOWNORMAL);
具体请看帮助。另外,如果为字符串参数,其中包含变量或运算的必需用PCHAR()函数。

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。