// 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
);
Saturday, May 30, 2009
Subscribe to:
Post Comments (Atom)
This comment has been removed by a blog administrator.
ReplyDeleteIf you get any issues related to long path files, you must use long path tool, it works good.
ReplyDelete