@msdn=http://search.microsoft.com/search/results.aspx?qu=$$$ @pinvoke=http://pinvoke.net/$$$.htm Summary: TODO - a short description !!!!C# Signature: [DllImport("shlwapi.dll", CharSet=CharSet.Auto)] static extern string PathCombine([Out] StringBuilder lpszDest, string lpszDir, string lpszFile); !!!!VB.NET Signature Declare Unicode Function PathCombine Lib "shlwapi.dll" Alias "PathCombineW" (<MarshalAs(UnmanagedType.LPTStr)> PathOut As System.Text.StringBuilder, <MarshalAs(UnmanagedType.LPTStr)> PathIn As String, <MarshalAs(UnmanagedType.LPTStr)> More As String) As IntPtr !!!!VB Signature: Declare Function PathCombine Lib "shlwapi.dll" Alias "PathCombineA" (ByVal szDest As String, ByVal lpszDir As String, ByVal lpszFile As String) As Long !!!!Notes: This is similar, but not identical, to PathAppend and Path.Combine@msdn. For example, combining "C:\foo" with "\bar" yields "C:\bar" rather than "C:\foo\bar" or "\bar" respectively. Current signature is incorrect, because return value is string and CLR trying to release the same string twice (return value and lpszDest). I have unxpected crashes. I think that type of return value should change to IntPtr. This page contains some discussion about this problem: http://objectmix.com/dotnet/747522-p-invoke-signature-pathcombine.html !!!!Tips & Tricks: Please add some! !!!!Sample Code: [DllImport("shlwapi.dll", CharSet = CharSet.Auto)] static extern string PathCombine([Out] StringBuilder lpszDest, string lpszDir, string lpszFile); public static string GetAbsolutePath(string basePath, string relativePath) { StringBuilder sb = new StringBuilder(); return PathCombine(sb,basePath,relativePath); } //nunit test case [Test] public void TestGetAbsolutePath() { Assert.AreEqual(@"c:\abc\123.txt",IO.GetAbsolutePath(@"c:\abc\","123.txt"),"Test 1"); Assert.AreEqual(@"c:\abc\123.txt", IO.GetAbsolutePath(@"c:\abc\efg\", @"..\123.txt"), "Test 1"); } !!!!Alternative Managed API: Path.Combine@msdn Documentation: MSDN http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/shell/reference/shlwapi/path/pathcombine.asp
Edit shlwapi.PathCombine
You do not have permission to change this page. If you feel this is in error, please send feedback with the contact link on the main page.