I got this thread from one of my senior, while discussing about our project. Till then, I didn’t noticed any differences between SHCreateDirectoryEx() and CreateDirectory(). But now.. Yes its is.. some .. lil difference is there.

just look at the function call

for eg:

if (CreateDirectory(“c:\\Test\\Test\\Test\\Test”,NULL))
        AfxMessageBox(“Created “);

if (ERROR_SUCCESS == SHCreateDirectoryEx(NULL,”c:\\Test\\Test\\Test\\Test”,NULL))

description from MSDN is like that for SHCreateDirectoryEX()

int SHCreateDirectoryEx(HWND hwnd, LPCTSTR pszPath, SECURITY_ATTRIBUTES *psa);

BOOL CreateDirectory(LPCTSTR lpPathName,LPSECURITY_ATTRIBUTES lpSecurityAttributes );

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, they will be created as well.

for CreateDirectory() the description is like this “ This function creates a new directory”


Hope now you noticed the difference from the description itself. 🙂



True commitment begins when we decide to do it anyway.