[DllImport("shlwapi.dll")]
public static extern Int32 PathRelativePathTo(
[Out] StringBuilder pszPath,
[In] String pszFrom,
[In] UInt32 dwAttrFrom,
[In] String pszTo,
[In] UInt32 dwAttrTo
);
const UInt32 FILE_ATTRIBUTE_DIRECTORY = 0x10;
const Int32 MAX_PATH = 260;
Declare Function PathRelativePathTo Lib "shlwapi.dll" (TODO) As TODO
None.
None.
Please add some!
StringBuilder str = new StringBuilder(MAX_PATH);
UInt32 dwAttr1, dwAttr2;
dwAttr1 = FILE_ATTRIBUTE_DIRECTORY;
dwAttr2 = 0;
Int32 nRet = PathRelativePathTo(
str,
@"c:\a\b\path", dwAttr1,
@"c:\a\x\y\file", dwAttr2
);
// Result: str.ToString() == @"..\..\x\y\file"
Do you know one? Please contribute it!