ShlwApiPathCombine Method

Note: This API is now obsolete.
Concatenates two strings that represent properly formed paths into one path; also concatenates any relative path elements.

Note: Misuse of this function can lead to a buffer overrun. We recommend the use of the safer PathCchCombine(StringBuilder, UInt32, String, String) or PathCchCombineEx(StringBuilder, UInt32, String, String, PathOptions) function in its place.

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)]
[ObsoleteAttribute("Misuse of this function can lead to a buffer overrun. We recommend the use of the safer NativeMethods.PathCchCombine or NativeMethods.PathCchCombineEx function in its place.", 
	false)]
public static IntPtr PathCombine(
	StringBuilder destination,
	string dir,
	string file
)

Parameters

destination  StringBuilder
A pointer to a buffer that, when this function returns successfully, receives the combined path string.

You must set the size of this buffer to MAX_PATH to ensure that it is large enough to hold the returned string.

dir  String
A pointer to a null-terminated string of maximum length MAX_PATH that contains the first path. This value can be NULL.
file  String
A pointer to a null-terminated string of maximum length MAX_PATH that contains the second path. This value can be NULL.

Return Value

IntPtr
A pointer to a buffer that, when this function returns successfully, receives the concatenated path string.

This is the same string pointed to by destination. If this function does not return successfully, this value is NULL.

Remarks

See Also