Creates a folder.
Syntax
int SHCreateDirectory(
HWND hwnd,
LPCWSTR pszPath
);
Parameters
- hwnd
-
[in] A handle to a parent window. This parameter can be set to NULL if no user interface is displayed.
- pszPath
-
[in] 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
Returns ERROR_SUCCESS if successful. If the operation fails, it returns one of the following error codes.
| ERROR_BAD_PATHNAME | The pszPath parameter was set to a relative path. |
| ERROR_FILENAME_EXCED_RANGE | The path pointed to by pszPath is too long. |
| ERROR_FILE_EXISTS | The directory exists. |
| ERROR_ALREADY_EXISTS | The directory exists. |
| ERROR_CANCELLED | The user canceled the operation. |
Remarks
Note This function is available through Windows XP Service Pack 2 (SP2) and Microsoft Windows Server 2003. It might be altered or unavailable in subsequent versions of Windows.
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.
Function Information
| Minimum DLL Version | shell32.dll version 5.0 or later |
|---|
| Custom Implementation | No |
|---|
| Header | shlobj.h |
|---|
| Import library | shell32.lib |
|---|
| Minimum operating systems |
Windows 2000 |
|---|