PathYetAnotherMakeUniqueName function (shlobj_core.h)

Creates a unique filename based on an existing filename.

Syntax

BOOL PathYetAnotherMakeUniqueName(
  [out]          PWSTR  pszUniqueName,
  [in]           PCWSTR pszPath,
  [in, optional] PCWSTR pszShort,
  [in, optional] PCWSTR pszFileSpec
);

Parameters

[out] pszUniqueName

Type: PWSTR

A string buffer that receives a null-terminated Unicode string that contains the fully qualified path of the unique file name. This buffer should be at least MAX_PATH characters long to avoid causing a buffer overrun.

[in] pszPath

Type: PCWSTR

A null-terminated Unicode string that contains the fully qualified path of folder that will contain the new file. If pszShort is set to NULL, this string must contain a full destination path, ending with the long file name that the new file name will be base on.

[in, optional] pszShort

Type: PCWSTR

A null-terminated Unicode string that contains the short file name that the unique name will be based on. Set this value to NULL to create a name based on the long file name.

[in, optional] pszFileSpec

Type: PCWSTR

A null-terminated Unicode string that contains the long file name that the unique name will be based on.

Return value

Type: BOOL

Returns TRUE if a unique name was successfully created; otherwise FALSE.

Remarks

If the generated path exceeds MAX_PATH characters, this function may return a truncated string in PathYetAnotherMakeUniqueName. In that case, the function returns FALSE.

Requirements

Requirement Value
Minimum supported client Windows 2000 Professional [desktop apps only]
Minimum supported server Windows 2000 Server [desktop apps only]
Target Platform Windows
Header shlobj_core.h (include Shlobj.h)
Library Shell32.lib
DLL Shell32.dll (version 5.0 or later)
API set ext-ms-win-shell-shell32-l1-2-1 (introduced in Windows 10, version 10.0.10240)

See also

PathMakeUniqueName