Syntax
BOOL SHGetSpecialFolderPath( HWND hwndOwner, LPTSTR lpszPath, int nFolder, BOOL fCreate );
Parameters
hwndOwner
- Handle to the owner window the client should specify if it displays a dialog box or message box.
lpszPath- 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.
nFolder- A CSIDL that identifies the folder of interest. If a virtual folder is specified, this function will fail.
fCreate- Indicates if the folder should be created if it does not already exist. If this value is nonzero, the folder will be created. If this value is zero, the folder will not be created.
Return Value
Returns TRUE if successful, or FALSE otherwise.
Remarks
The Microsoft Internet Explorer 4.0 Desktop Update must be installed for this function to be available.
With Microsoft Windows 2000, this function is superseded by ShGetFolderPath. You can use this function on earlier systems by including the redistributable dynamic-link library (DLL), ShFolder.dll.
Function Information
Minimum DLL Version | shell32.dll version 4.71 or later |
---|---|
Custom Implementation | No |
Header | shlobj.h |
Import library | shell32.lib |
Minimum operating systems | Windows 2000, Windows NT 4.0 with Internet Explorer 4.0, Windows 98, Windows 95 with Internet Explorer 4.0 |
Unicode | Implemented as ANSI and Unicode versions. |
Retrieves the path of a special folder, identified by its CSIDL.
CSIDL values provide a unique system-independent way to identify special folders used frequently by applications, but which may not have the same name or location on any given system. For example, the system folder may be "C:\Windows" on one system and "C:\Winnt" on another. These constants are defined in Shlobj.h and Shfolder.h.
value: CSIDL_COMMON_STARTUP (0x0018)The file system directory used to physically store file objects on the desktop (not to be confused with the desktop folder itself). A typical path is C:\Documents and Settings\username\Desktop.
CSIDL_APPDATA (0x001a)