getSpecialFolder

Syntax

int getSpecialFolder(int CSIDL, string path)

Arguments

CSIDL
A CSIDL (Constant Special Item ID List) value that identifies the folder of interest. A full list of CSIDL values can be found at https://docs.microsoft.com/en-us/windows/win32/shell/csidl
path
The string where the folder path result will be stored

Return

Returns true if the operation was successful, false otherwise

Description

Retrieves the path of a Windows "Special Folder", such as the user's Desktop or My Documents folder. This function is useful for locating the folders where a program can save its data, particularly on systems newer than Windows Vista.

Some useful CSIDL Values:

CSIDL_APPDATA
Hidden folder for application data specific to that user. Use for things like INI files that the user shouldn't edit.
CSIDL_COMMON_APPDATA
A hidden application data folder shared with all users of a computer. Use this for settings/data that are the same for all users of the computer.
CSIDL_COMMON_DOCUMENTS
Like the My Documents folder, but shared with all users.
CSIDL_COMMON_PICTURES
A public folder of pictures shared by all users on the computer
CSIDL_DESKTOPDIRECTORY
The user's Desktop folder.
CSIDL_FONTS
A virtual folder that contains fonts. A typical path is C:\Windows\Fonts.
CSIDL_MYPICTURES
The user's My Pictures folder.
CSIDL_PERSONAL
The user's My Documents folder.

Example

OnFilterStart: {
  bool errOK;
  errOK = getSpecialFolder( CSIDL_COMMON_APPDATA , str8);
  if (errOK == true) msgBox(MB_OK, "Hello", str8);
  return true;
}

See Also

mkdir, rmdir

Comments

Everyone can add his comments about his experiences with this function here. Tips for using it are welcome, too.