ShlwApiPathCompactPath Method

Truncates a file path to fit within a given pixel width by replacing path components with ellipses.

Definition

Namespace: DevCase.Win32.NativeMethods
Assembly: DevCase.net48 (in DevCase.net48.dll) Version: 6.0.0.0 (6.0)
XMLNS for XAML: Not mapped to an xmlns.
[DllImportAttribute("ShlwApi.dll", CharSet = CharSet.Auto, BestFitMapping = false, 
	ThrowOnUnmappableChar = true, SetLastError = true)]
public static bool PathCompactPath(
	IntPtr hDC,
	StringBuilder path,
	uint width
)

Parameters

hDC  IntPtr
A handle to the device context used for font metrics. This value can be NULL.
path  StringBuilder
A pointer to a null-terminated string of length MAX_PATH that contains the path to be modified. On return, this buffer will contain the modified string.
width  UInt32
The width, in pixels, in which the string must fit.

Return Value

Boolean
Returns if the path was successfully compacted to the specified width.

Returns on failure, or if the base portion of the path would not fit the specified width.

Remarks

See Also