随笔分类 -  API 文件处理函数

WinAPI: CopyFileEx
摘要:function CopyFileEx( lpExistingFileName: PWideChar; { 源文件 } lpNewFileName: PWideChar; { 新的目标文件 } lpProgressRoutine: TFNProgressRoutine; { 回调函数; 每复制 64K 调用一次 } lpData: Pointer; { 给回调函数的参数 } pbCanc... 阅读全文
posted @ 2010-01-08 21:44 万一 阅读(6514) 评论(5) 推荐(1) 编辑
WinAPI: WritePrivateProfileString、GetPrivateProfileString - 简单读写 Ini 文件
摘要:尽管使用 TIniFile 类很方便, 但我觉得还是用系统 API 操作更顺手, 读写各只需要一行代码, 也不用 uses IniFiles. 本例效果图: 代码文件: unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dial... 阅读全文
posted @ 2008-06-02 13:48 万一 阅读(7368) 评论(17) 推荐(0) 编辑
WinAPI: SetVolumeLabel - 设置磁盘卷标
摘要://声明: SetVolumeLabel( lpRootPathName: PChar; {根路径} lpVolumeName: PChar {新卷标指针, nil 表示删除卷标} ): BOOL; //举例: begin SetVolumeLabel('c:\', 'NewLabel'); end; 阅读全文
posted @ 2008-02-12 11:41 万一 阅读(4104) 评论(0) 推荐(0) 编辑
WinAPI: SetCurrentDirectory、GetCurrentDirectory - 设置与获取当前目录
摘要://声明: SetCurrentDirectory( lpPathName: PAnsiChar {路径名} ): BOOL; GetCurrentDirectory( nBufferLength: DWORD; {缓冲区大小} lpBuffer: PAnsiChar {缓冲区} ): DWORD; {返回目录实际长度} //举例: var... 阅读全文
posted @ 2008-02-12 10:44 万一 阅读(9047) 评论(0) 推荐(0) 编辑
WinAPI: RemoveDirectory - 删除空目录
摘要://声明: RemoveDirectory( lpPathName: PAnsiChar {目录名} ): BOOL; //举例: var Dir: string; begin Dir := 'c:\temp\Test'; if RemoveDirectory(PChar(Dir)) then ShowMessage(Dir + ' 已被删除') else ... 阅读全文
posted @ 2008-02-12 10:33 万一 阅读(4259) 评论(3) 推荐(0) 编辑
WinAPI: CreateDirectoryEx - 根据模版建立文件夹
摘要://声明: CreateDirectoryEx ( lpTemplateDirectory: PChar; {模版目录名} lpPathName: PChar; {新目录名} lpSecurityAttributes: PSecurityAttributes {TSecurityAttributes 结构的指针... 阅读全文
posted @ 2008-02-12 10:23 万一 阅读(3829) 评论(0) 推荐(0) 编辑
WinAPI: CreateDirectory - 建立文件夹
摘要://声明: CreateDirectory( lpPathName: PChar; {目录名} lpSecurityAttributes: PSecurityAttributes {TSecurityAttributes 结构的指针} ): BOOL; //TSecurityAttributes 是 _SECURITY_ATTRIBUTES... 阅读全文
posted @ 2008-02-12 10:04 万一 阅读(9292) 评论(0) 推荐(0) 编辑
WinAPI: CopyFile - 复制文件
摘要://声明: CopyFile( lpExistingFileName: PChar; {源文件} lpNewFileName: PChar; {目标文件} bFailIfExists: BOOL {如果目标文件存在, True: 失败; False: 覆盖} ): BOOL; //例1: begin CopyFile('c:\BOOTLOG.TXT',... 阅读全文
posted @ 2008-02-11 08:38 万一 阅读(24156) 评论(19) 推荐(2) 编辑
WinAPI: GetTempFileName - 生成一个临时文件名
摘要://声明: GetTempFileName( lpPathName: PChar; {路径} lpPrefixString: PChar; {前缀} uUnique: UINT; {指定生成文件名的数字, 文件名将根据参数2、参数3来生成} lpTempFileName: PChar {文件名需要的缓冲区} ): UINT; ... 阅读全文
posted @ 2008-02-07 19:47 万一 阅读(16161) 评论(8) 推荐(1) 编辑
WinAPI: GetTempPath - 获取临时文件夹路径
摘要://声明: GetTempPath( nBufferLength: DWORD; {缓冲区大小} lpBuffer: PChar {缓冲区} ): DWORD; {返回实际长度} //举例: var arr: array[0..MAX_PATH] of Char; num: DWORD; begin num := GetTempPa... 阅读全文
posted @ 2008-02-07 18:59 万一 阅读(13967) 评论(0) 推荐(1) 编辑
WinAPI: GetSystemDirectory - 返回 System 文件夹路径
摘要://声明: GetSystemDirectory( lpBuffer: PChar; {缓冲区} uSize: UINT {缓冲区大小} ): UINT; {返回实际长度} //举例: var arr: array[0..MAX_PATH] of Char; num: UINT; begin num := GetSystemDirectory... 阅读全文
posted @ 2008-02-07 18:49 万一 阅读(6783) 评论(9) 推荐(1) 编辑
WinAPI: GetWindowsDirectory - 获取 Windows 所在目录
摘要://声明: GetWindowsDirectory( lpBuffer: PChar; {缓冲区} uSize: UINT {缓冲区大小} ): UINT; {返回实际长度} //举例: var arr: array[0..MAX_PATH] of Char; num: UINT; begin num := GetWindowsDirecto... 阅读全文
posted @ 2008-02-07 17:27 万一 阅读(5945) 评论(7) 推荐(0) 编辑