//声明: 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;