Click to Rate and Give Feedback
MSDN
MSDN Library
User Interface
Windows Shell
Shell Reference
Shell Functions
 SHCreateDirectory Function

  Switch on low bandwidth view
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 Microsoft Windows XP Service Pack 2 (SP2) and 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 What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Dropped in Vista      orkybash   |   Edit   |   Show History
This function has indeed been dropped from Windows Vista. Use SHCreateDirectoryEx instead.
Tags What's this?: Add a tag
Flag as ContentBug
Processing
© 2009 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker