Skip to content

Latest commit

 

History

History
76 lines (52 loc) · 2.08 KB

SHGetFolderPath.md

File metadata and controls

76 lines (52 loc) · 2.08 KB

Home

Function name : SHGetFolderPath

Group: Shell Functions - Library: shell32


Takes the CSIDL of a folder and returns the pathname.


Code examples:

How to get the path to a Special Folder

Declaration:

HRESULT SHGetFolderPath(
	HWND hwndOwner,
	int nFolder,
	HANDLE hToken,
	DWORD dwFlags,
	LPTSTR pszPath
);  

FoxPro declaration:

DECLARE SHORT SHGetFolderPath IN shell32;
	INTEGER hwndOwner,;
	INTEGER nFolder,;
	INTEGER hToken,;
	INTEGER dwFlags,;
	STRING @pszPath  

Parameters:

hwndOwner [in] Handle to an owner window. This parameter is typically set to NULL.

nFolder [in] A CSIDL value that identifies the folder whose path is to be retrieved.

hToken [in] An access token that can be used to represent a particular user.

dwFlags [in] Flags to specify which path is to be returned.

pszPath [out] Pointer to a null-terminated string of length MAX_PATH which will receive the path.


Return value:

Returns standard HRESULT codes, including the following: S_FALSE, E_FAIL, E_INVALIDARG, SUCCESS (0).


Comments:

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.

CSIDL list.

For Windows versions 98, NT4 the SHGetFolderPath is obtained through SHFolder.dll, not through Shell32.dll.

SHFolder.dll continues to be included for backward compatibility, though the function is now implemented in Shell32.dll.

See also: SHGetSpecialFolderLocation, SHGetKnownFolderPath, SHGetPathFromIDList.