[DllImport("shlwapi.dll", CharSet=CharSet.Auto)]
static extern void PathStripPath([In,Out] StringBuilder pszPath);
Declare Function PathStripPath Lib "shlwapi.dll" (TODO) As TODO
This is similar, but not identical, to Path.GetFileName. If the input string ends with a directory, the directory is returned rather than nothing; for example, "C:\foo\" becomes "foo\", "C:" stays "C:".
Please add some!
StringBuilder str = new StringBuilder(@"c:\dir1\file.txt");
PathStripPath(str);
// Result: str.ToString() == "file.txt"
Path.GetFileName