//声明: CreateDirectory( lpPathName: PChar; {目录名} lpSecurityAttributes: PSecurityAttributes {TSecurityAttributes 结构的指针} ): BOOL; //TSecurityAttributes 是 _SECURITY_ATTRIBUTES 结构的重定义 _SECURITY_ATTRIBUTES = record nLength: DWORD; {结构体的大小} lpSecurityDescriptor: Pointer; {安全描述} bInheritHandle: BOOL; {安全描述的对象能否被新创建的进程继承} end;
//举例: var dir: string; begin dir := 'c:/temp/TestDir'; CreateDirectory(PChar(dir), nil); {第二个参数一般设为 nil, 表示使用系统默认的安全属性} end;//声明: CreateDirectoryEx ( lpTemplateDirectory: PChar; {模版目录名} lpPathName: PChar; {新目录名} lpSecurityAttributes: PSecurityAttributes {TSecurityAttributes 结构的指针} ): BOOL; //TSecurityAttributes 是 _SECURITY_ATTRIBUTES 结构的重定义 _SECURITY_ATTRIBUTES = record nLength: DWORD; {结构体的大小} lpSecurityDescriptor: Pointer; {安全描述} bInheritHandle: BOOL; {安全描述的对象能否被新创建的进程继承} end;

这篇博客介绍了如何在Delphi中使用WinAPI进行文件处理,包括CreateDirectory创建目录、CreateDirectoryEx根据模板创建目录、RemoveDirectory删除空目录、SetCurrentDirectory与GetCurrentDirectory设置和获取当前目录,以及SetVolumeLabel设置磁盘卷标。示例代码详实,易于理解。
最低0.47元/天 解锁文章
1948

被折叠的 条评论
为什么被折叠?



