PathCompactPathExA function

Truncates a path to fit within a certain number of characters by replacing path components with ellipses.

Syntax

BOOL PathCompactPathExA(
  LPSTR  pszOut,
  LPCSTR pszSrc,
  UINT   cchMax,
  DWORD  dwFlags
);

Parameters

pszOut

Type: LPTSTR

The address of the string that has been altered.

pszSrc

Type: LPCTSTR

A pointer to a null-terminated string of length MAX_PATH that contains the path to be altered.

cchMax

Type: UINT

The maximum number of characters to be contained in the new string, including the terminating null character. For example, if cchMax = 8, the resulting string can contain a maximum of 7 characters plus the terminating null character.

dwFlags

Type: DWORD

Return Value

Type: BOOL

Returns TRUE if successful, or FALSE otherwise.

Remarks

The '/' separator will be used instead of '' if the original string used it. If pszSrc points to a file name that is too long, instead of a path, the file name will be truncated to cchMax characters, including the ellipsis and the terminating NULL character. For example, if the input file name is "My Filename" and cchMax is 10, PathCompactPathEx will return "My Fil...".

Requirements

   
Windows version Windows 2000 Professional, Windows XP [desktop apps only] Windows 2000 Server [desktop apps only]
Target Platform Windows
Header shlwapi.h
Library Shlwapi.lib
DLL Shlwapi.dll (version 4.71 or later)