SHGetSpecialFolderPathA function (shlobj_core.h)

[SHGetSpecialFolderPath is not supported. Instead, use SHGetFolderPath.]

Retrieves the path of a special folder, identified by its CSIDL.


BOOL SHGetSpecialFolderPathA(
        HWND  hwnd,
  [out] LPSTR pszPath,
  [in]  int   csidl,
  [in]  BOOL  fCreate



Type: HWND


[out] pszPath


A pointer to a null-terminated string that receives the drive and path of the specified folder. This buffer must be at least MAX_PATH characters in size.

[in] csidl

Type: int

A CSIDL that identifies the folder of interest. If a virtual folder is specified, this function will fail.

[in] fCreate

Type: BOOL

Indicates whether the folder should be created if it does not already exist. If this value is nonzero, the folder is created. If this value is zero, the folder is not created.

Return value

Type: BOOL

TRUE if successful; otherwise, FALSE.


The Microsoft Internet Explorer 4.0 Desktop Update must be installed for this function to be available.


The shlobj_core.h header defines SHGetSpecialFolderPath as an alias which automatically selects the ANSI or Unicode version of this function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with code that not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more information, see Conventions for Function Prototypes.


Requirement Value
Minimum supported client Windows 2000 Professional [desktop apps only]
Minimum supported server Windows 2000 Server [desktop apps only]
Target Platform Windows
Header shlobj_core.h (include Shlobj.h, Shlobj_core.h)
Library Shell32.lib
DLL Shell32.dll (version 4.71 or later)