SHCreateDirectory function (shlobj_core.h)
[SHCreateDirectory is available for use in the operating systems specified in the Requirements section. It may be altered or unavailable in subsequent versions.]
Creates a new file system folder.
Syntax
int SHCreateDirectory(
[in, optional] HWND hwnd,
[in] PCWSTR pszPath
);
Parameters
[in, optional] hwnd
Type: HWND
A handle to a parent window. This parameter can be set to NULL if no user interface is displayed.
[in] pszPath
Type: PCWSTR
A pointer to a null-terminated Unicode string that contains the fully qualified path of the directory. This string should have no more than MAX_PATH characters, including the terminating null character.
Return value
Type: int
Returns ERROR_SUCCESS if successful. If the operation fails, other error codes can be returned, including those listed here. For values not specifically listed, see System Error Codes.
Return code | Description |
---|---|
|
The pszPath parameter was set to a relative path. |
|
The path pointed to by pszPath is too long. |
|
The directory exists. |
|
The directory exists. |
|
The user canceled the operation. |
Remarks
This function creates a file system folder whose fully qualified path is given by pszPath. If one or more of the intermediate folders do not exist, it creates them.
To set security attributes on a new folder, use SHCreateDirectoryEx.
Requirements
Requirement | Value |
---|---|
Minimum supported client | Windows XP [desktop apps only] |
Minimum supported server | Windows Server 2003 [desktop apps only] |
Target Platform | Windows |
Header | shlobj_core.h (include Shlobj.h) |
Library | Shell32.lib |
DLL | Shell32.dll (version 5.0 or later) |