@msdn=http://search.microsoft.com/search/results.aspx?qu=$$$ @pinvoke=http://pinvoke.net/$$$.htm Summary: Compares two paths to determine if they share a common prefix. A prefix is one of these types: "C:\\", ".", "..", "..\\". !!!!C# Signature: [DllImport("shlwapi.dll", CharSet=CharSet.Auto)] static extern Int32 PathCommonPrefix( [In] String pszFile1, [In] String pszFile2, [Out] StringBuilder pszPath ); !!!!VB Signature: Declare Function PathCommonPrefix Lib "shlwapi.dll" Alias "PathCommonPrefixA" (ByVal pszFile1 As String, ByVal pszFile2 As String, ByVal pszPath As String) As Long !!!!User-Defined Types: None. !!!!Notes: pszPath may be null, but must have a capacity of at least MAX_PATH - 1 if supplied. The return value is the length of the common prefix. !!!!Tips & Tricks: Please add some! !!!!Sample Code: StringBuilder str = new StringBuilder(MAX_PATH); Int32 nRet = PathCommonPrefix( @"C:\win\desktop\temp.txt", @"c:\win\tray\sample.txt", str ); // Result: nRet == 6 && str.ToString() == @"C:\win" !!!!Alternative Managed API: Do you know one? Please contribute it! Documentation: MSDN http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/shell/reference/shlwapi/path/pathremovefilespec.asp
Edit shlwapi.PathCommo...
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.