PathAppend (shlwapi)
Last changed: -171.161.160.10

.
Summary
Appends a path string to another path string in place

C# Signature:

[DllImport("shlwapi.dll", CharSet=CharSet.Auto)]
static extern bool PathAppend([In, Out] StringBuilder pszPath, string pszMore);

VB.NET Signature

''' <summary>
''' Appends one path to the end of another.
''' </summary>
''' <param name="pszPath">A pointer to a null-terminated string to which the path specified in pszMore is appended.</param>
''' <param name="pszMore">A pointer to a null-terminated string of maximum length MAX_PATH that contains the path to be appended.</param>
''' <returns>Returns TRUE if successful, or FALSE otherwise.</returns>
''' <remarks>
''' This function automatically inserts a backslash between the two strings,
''' if one is not already present.
''' The path supplied in pszPath cannot begin with "..\\" or ".\\" to produce a relative path
''' string. If present, those periods are stripped from the output string.
''' For example, appending "path3" to "..\\path1\\path2" results in an output of "\path1\path2\path3" rather than "..\path1\path2\path3".
''' </remarks>
<DllImport("shlwapi.dll", EntryPoint:="PathAppendW", SetLastError:=True, CharSet:=CharSet.Unicode)> _
Public Function PathAppend(<MarshalAs(UnmanagedType.LPTStr)>pszPath As System.Text.StringBuilder, _
             <MarshalAs(UnmanagedType.LPTStr)>pszMore As String) As <MarshalAs(UnmanagedType.Bool)>Boolean

End Function

VB Signature

Public Declare Function PathAppend Lib "shlwapi" Alias "PathAppendA" _
        (ByVal pszPath As String, _
         ByVal pszMore As String) As Long

Notes:

This is similar, but not identical, to PathCombine and Path.Combine. For example, appending "C:\foo" with "\bar" yields "C:\foo\bar" rather than "C:\bar" or "\bar", respectively.

Tips & Tricks:

Please add some!

Sample Code:

Please add some!

Alternative Managed API:

Path.Combine

Documentation
PathAppend at MSDN