WinAPI: CreateDirectoryEx 根据模版建立文件夹

//声明:
CreateDirectoryEx (
  lpTemplateDirectory: PChar;               {模版目录名}
  lpPathName: PChar;                        {新目录名}
  lpSecurityAttributes: PSecurityAttributes {TSecurityAttributes 结构的指针}
): BOOL;						

//TSecurityAttributes 是 _SECURITY_ATTRIBUTES 结构的重定义
_SECURITY_ATTRIBUTES = record
  nLength: DWORD;                {结构体的大小}
  lpSecurityDescriptor: Pointer; {安全描述}
  bInheritHandle: BOOL;          {安全描述的对象能否被新创建的进程继承}
end;

//举例: var TDir,Dir: string; begin TDir := 'c:\temp\Test'; {假如模版目录是隐藏的} Dir := 'c:\temp\NewDir'; {创建的新目录也是隐藏的} CreateDirectoryEx(PChar(TDir), PChar(Dir), nil); {如果不需要模版, 可以:} //CreateDirectoryEx(nil, PChar(Dir), nil); end;
原文地址:https://www.cnblogs.com/del/p/1067178.html