IKnownFolder::SetPath method (shobjidl_core.h)
Assigns a new path to a known folder.
Syntax
HRESULT SetPath(
[in] DWORD dwFlags,
[in] LPCWSTR pszPath
);
Parameters
[in] dwFlags
Type: DWORD
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%
.
[in] pszPath
Type: LPCWSTR
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
Type: HRESULT
If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.
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.
Requirements
Requirement | Value |
---|---|
Minimum supported client | Windows Vista [desktop apps only] |
Minimum supported server | Windows Server 2008 [desktop apps only] |
Target Platform | Windows |
Header | shobjidl_core.h (include Shobjidl.h) |
DLL | Shell32.dll |