ShlwApiPathCompactPath Method
Truncates a file path to fit within a given pixel width by replacing path components with ellipses.
Namespace: DevCase.Win32.NativeMethodsAssembly: 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
)
<DllImportAttribute("ShlwApi.dll", CharSet := CharSet.Auto, BestFitMapping := false,
ThrowOnUnmappableChar := true, SetLastError := true>]
Public Shared Function PathCompactPath (
hDC As IntPtr,
path As StringBuilder,
width As UInteger
) As Boolean
Dim hDC As IntPtr
Dim path As StringBuilder
Dim width As UInteger
Dim returnValue As Boolean
returnValue = ShlwApi.PathCompactPath(hDC,
path, width)
public:
[DllImportAttribute(L"ShlwApi.dll", CharSet = CharSet::Auto, BestFitMapping = false,
ThrowOnUnmappableChar = true, SetLastError = true)]
static bool PathCompactPath(
IntPtr hDC,
StringBuilder^ path,
unsigned int width
)
[<DllImportAttribute("ShlwApi.dll", CharSet = CharSet.Auto, BestFitMapping = false,
ThrowOnUnmappableChar = true, SetLastError = true)>]
static member PathCompactPath :
hDC : IntPtr *
path : StringBuilder *
width : uint32 -> bool
No code example is currently available or this language may not be supported.
- 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.
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.