Shell Functions


SHCreateDirectory Function

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_PATHNAMEThe pszPath parameter was set to a relative path.
ERROR_FILENAME_EXCED_RANGEThe path pointed to by pszPath is too long.
ERROR_FILE_EXISTSThe directory exists.
ERROR_ALREADY_EXISTSThe directory exists.
ERROR_CANCELLEDThe 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 Versionshell32.dll version 5.0 or later
Custom ImplementationNo
Headershlobj.h
Import libraryshell32.lib
Minimum operating systems Windows 2000
Tags :


Community Content

orkybash
Dropped in Vista
This function has indeed been dropped from Windows Vista. Use SHCreateDirectoryEx instead.
Tags :

Page view tracker