Help Center

AfxPathCompactPathExfunction

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

String ManagementfunctionAfxPath.incdocumented

Syntax

FUNCTION AfxPathCompactPathEx (BYREF wszPath AS CONST WSTRING, BYVAL cchMax AS DWORD) AS DWSTRING

Parameters

NameDescription
wszPathA string that contains the path to be altered.
cchMaxThe 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.

Return value

The compacted path.

Description

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

Remarks

The '/' separator will be used instead of '\\' if the original string used it. If wszPath 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, AfxPathCompactPathEx will return "My Fil...".

Example

DIM dws AS DWSTRING = AfxPathCompactPathEx("c:\test\My Filename", 18)

Reference

  • Include file AfxPath.inc
  • Defined in AfxNova/AfxPath.inc:252
  • Documented in String Management/Path and Url Procedures.md
  • Topic: Path and Url procedures