Ask Learn
Preview
Please sign in to use this experience.
Sign inThis browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
[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.
int SHCreateDirectory(
[in, optional] HWND hwnd,
[in] PCWSTR pszPath
);
[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.
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. |
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.
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) |
Please sign in to use this experience.
Sign in