Author: Miroslav Stampar
URL: http://mstampar.awardspace.com/
// Short/Long path conversion
// Long To Short Path/File Name:
[DllImport("kernel32.dll", CharSet = CharSet.Auto)]
public static extern int GetShortPathName(
[MarshalAs(UnmanagedType.LPTStr)] string path,
[MarshalAs(UnmanagedType.LPTStr)] StringBuilder shortPath,
int shortPathLength
);
// ...
StringBuilder shortPath = new StringBuilder(1024);
GetShortPathName(textBoxFilename.Text, shortPath, shortPath.Capacity);
// Short To Long Path/File Names:
[DllImport("kernel32.dll", CharSet = CharSet.Auto)]
public static extern int GetLongPathName(
[MarshalAs(UnmanagedType.LPTStr)]
string path,
[MarshalAs(UnmanagedType.LPTStr)]
StringBuilder longPath,
int longPathLength
);










