This topic has not yet been rated - Rate this topic

IKnownFolder::SetPath method

Applies to: desktop apps only

Assigns a new path to a known folder.

Syntax

HRESULT SetPath(
  [in]  DWORD dwFlags,
  [in]  LPCWSTR pszPath
);

Parameters

dwFlags [in]

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%.

pszPath [in]

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

Minimum supported client

Windows Vista

Minimum supported server

Windows Server 2008

Header

Shobjidl.h

IDL

Shobjidl.idl

DLL

Shell32.dll

See also

IKnownFolder
SHSetKnownFolderPath

 

 

Send comments about this topic to Microsoft

Build date: 3/7/2012

Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ