PathCompactPathEx

C# Signature:

[DllImport("shlwapi.dll", CharSet=CharSet.Auto)]
static extern bool PathCompactPathEx([Out] StringBuilder pszOut, string szPath, int cchMax, int dwFlags);

VB.NET Signature:

''' <summary>
''' Truncates a path to fit within a certain number of characters by replacing path components with ellipses.
''' </summary>
''' <param name="pszOut">The address of the string that has been altered.</param>
''' <param name="pszSrc">A pointer to a null-terminated string of length MAX_PATH that contains the path to be altered.</param>
''' <param name="cchMax">
''' 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.
''' </param>
''' <param name="reserved">Reserved</param>
''' <returns>Returns TRUE if successful, or FALSE otherwise.</returns>
<DllImport("shlwapi.dll", EntryPoint:="PathCompactPathExW",  SetLastError:=True, CharSet:=CharSet.Unicode)> _
Shared Public Function PathCompactPathEx(
                      <MarshalAs(UnmanagedType.LPTStr)> pszOut As System.Text.StringBuilder,
                      <MarshalAs(UnmanagedType.LPTStr)> pszSrc As String,
                      cchMax As UInteger,
                      reserved As Integer
                      ) As <MarshalAs(UnmanagedType.Bool)> Boolean
    End Function

VB Signature:

C# Example

VB Example

VB Example

Última actualización