Share via


KF_FLAG Constants

Specify special retrieval options for known folders. These flags supersede CSIDL values, which have parallel meanings.

Constants

  • KF_FLAG_CREATE (0x00008000)
    Forces the creation of the specified folder if that folder does not already exist. The security provisions predefined for that folder are applied. If the folder does not exist and cannot be created, the function returns a failure code and no path is returned. This value can be used only with the following functions and methods:

  • KF_FLAG_DONT_VERIFY (0x00004000)
    Specifies not to verify the folder's existence before attempting to retrieve the path or IDList. If this flag is not set, an attempt is made to verify that the folder is truly present at the path. If that verification fails due to the folder being absent or inaccessible, the function returns a failure code and no path is returned.

    If the folder is located on a network, the function might take some time to execute. Setting this flag can reduce that lagtime.

  • KF_FLAG_DONT_UNEXPAND (0x00002000)
    Stores the full path in the registry without environment strings. If this flag is not set, portions of the path may be represented by environment strings such as %USERPROFILE%. This flag can only be used with SHSetKnownFolderPath and IKnownFolder::SetPath.

  • KF_FLAG_NO_ALIAS (0x00001000)
    Gets the true system path for the folder, free of any aliased placeholders such as %USERPROFILE%, returned by SHGetKnownFolderIDList and IKnownFolder::GetIDList. This flag has no effect on paths returned by SHGetKnownFolderPath and IKnownFolder::GetPath. By default, known folder retrieval functions and methods return the aliased path if an alias exists.

  • KF_FLAG_INIT (0x00000800)
    Initializes the folder using its Desktop.ini settings. If the folder cannot be initialized, the function returns a failure code and no path is returned. This flag should be combined with KF_FLAG_CREATE, because if the folder has not yet been created, the initialization fails because the result of KF_FLAG_INIT is only a desktop.ini file, not its directory. KF_FLAG_CREATE | KF_FLAG_INIT will always succeed.

    If the folder is located on a network, the function might take longer to execute.

  • KF_FLAG_DEFAULT_PATH (0x00000400)
    Gets the default path for a known folder that is redirected elsewhere. If this flag is not set, the function retrieves the current—and possibly redirected—path of the folder. This flag includes a verification of the folder's existence unless KF_FLAG_DONT_VERIFY is also set.

  • KF_FLAG_NOT_PARENT_RELATIVE (0x00000200)
    Gets the folder's default path independent of the current location of its parent. KF_FLAG_DEFAULT_PATH must also be set.

  • KF_FLAG_SIMPLE_IDLIST (0x00000100)
    Build a simple pointer to an item identifier list (PIDL).

Remarks

KF_FLAG constants are defined in Shlobj.h.

See Also

SHCreateItemInKnownFolder, IKnownFolder::GetShellItem