SHGetUserPicturePathEx

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

Syntax

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

Parameters

pwszUserOrPicName
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.
sguppFlags
Function options, can be 0 or a combination of the following:
SGUPP_DIRECTORY (0x1)
Make pwszPicPath return only the picture directory
SGUPP_DEFAULTDIRECTORY (0x2)
Make pwszPicPath return only the default pictures directory
SGUPP_CREATEPICTURESDIR (0x80000000)
Create the (default) pictures directory if it doesn't exist
pwszDesiredSrcExt
Desired filetype of the source picture. Defaults to .bmp if NULL is given.
pwszPicPath
Pointer to a buffer that receives the copied file path or the picture directory depending on the values in sguppFlags. Cannot be NULL.
picPathLen
Length of the pwszPicPath buffer in chars
pwszSrcPath
Buffer to which the original path of the users picture is copied
srcLen
Length of the pwszSrcPath buffer in chars

Return Value

S_OK on success, standard COM error on failure

Remarks

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.