Search
Module:
Directory

   Desktop Functions:

   Smart Device Functions:


Show Recent Changes
Subscribe (RSS)
Misc. Pages
Comments
FAQ
Helpful Tools
Playground
Suggested Reading
Website TODO List
Download Visual Studio Add-In

PathAppend (shlwapi)
 
.
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

Please edit this page!

Do you have...

  • helpful tips or sample code to share for using this API in managed code?
  • corrections to the existing content?
  • variations of the signature you want to share?
  • additional languages you want to include?

Select "Edit This Page" on the right hand toolbar and edit it! Or add new pages containing supporting types needed for this API (structures, delegates, and more).

 
Access PInvoke.net directly from VS:
Terms of Use
Edit This Page
Find References
Show Printable Version
Revisions