Go to Home Page

Copies the users account picture to a temporary directory and returns the path or returns various paths relating to user pictures


HRESULT NTAPI SHGetUserPicturePathEx (
    LPCWSTR pwszUserOrPicName,
    DWORD sguppFlags,
    LPCWSTR pwszDesiredSrcExt,
    LPWSTR pwszPicPath,
    UINT picPathLen,
    LPWSTR pwszSrcPath,
    UINT srcLen


The name of a user account on this computer, or desired file name of the current users picture. Can be NULL to indicate the current users' name.
Function options, can be 0 or a combination of the following:
Make pwszPicPath return only the picture directory
Make pwszPicPath return only the default pictures directory
Create the (default) pictures directory if it doesn't exist
Desired filetype of the source picture. Defaults to .bmp if NULL is given.
Pointer to a buffer that receives the copied file path or the picture directory depending on the values in sguppFlags. Cannot be NULL.
Length of the pwszPicPath buffer in chars
Buffer to which the original path of the users picture is copied
Length of the pwszSrcPath buffer in chars

Return Value

S_OK on success, standard COM error on failure


If either of SGUPP_DIRECTORY or SGUPP_DEFAULTDIRECTORY are specified in sguppFlags, no copy of the users' picture is made and the contents of pwszSrcPath are undefined.

If pwszUserOrPicName is the name of a user account on the local computer, their picture is the one copied and not the current users. If not, %TMP%\[pwszUserOrPicName].bmp is used as the filename for the copy of the calling users picture.

If the source picture doesn't have the extension given in pwszDesiredSrcExt, its path is not returned in pwszSrcPath. The rest of the function is unaffected.

The paths returned by the SGUPP_ flags are:

SGUPP_DIRECTORY - %ALLUSERSPROFILE%\Microsoft\User Account Pictures
SGUPP_DEFAULTDIRECTORY - %ALLUSERSPROFILE%\Microsoft\User Account Pictures\Default Pictures

This function is also known as _SHGetUserPicturePathEx@28.