Assigns a new path to a known folder.
Syntax
HRESULT SetPath(
DWORD dwFlags,
LPCWSTR pszPath
);
Parameters
- dwFlags
-
[in] Either zero or the following value:
KF_FLAG_DONT_UNEXPAND- Set the full path without environment strings. If this flag is not set, portions of the path at pszPath may be represented by environment strings such as
%USERPROFILE%.
- pszPath
-
[in] Pointer to the folder's new path. This is a null-terminated Unicode string of length MAX_PATH. This path cannot be of zero length. If this value is NULL, the IKnownFolder::SetPath sets the path to the default value.
Return Value
Returns S_OK if successful, or an error value otherwise.
Remarks
This method cannot be called on folders of type KF_CATEGORY_FIXED or KF_CATEGORY_VIRTUAL.
To call this method on a folder of type KF_CATEGORY_COMMON, the calling application must be running with elevated privileges.
This method is equivalent to SHSetKnownFolderPath.
See Also