Hi all,
Such functionality does exist, but as a part of the Win32 API; therefore
interop is required. If you're using C#, as I assume you are since you
posted to this ng, then place the following pinvoke thunks in your code -
[DllImport("kernel32.dll", CharSet = CharSet.Auto)]
public static extern int GetShortPathName(
[MarshalAs(UnmanagedType.LPTStr)]
System.String path,
[MarshalAs(UnmanagedType.LPTStr)]
System.Text.StringBuilder shortPath,
System.Int32 shortPathLength);
[DllImport("kernel32", CharSet = CharSet.Auto)]
public static extern int GetLongPathName(
[MarshalAs(UnmanagedType.LPTStr)]
System.String path,
[MarshalAs(UnmanagedType.LPTStr)]
System.Text.StringBuilder longPath,
System.Int32 longPathLength);
And then call them from your C# code. The StringBuilder object receives the
result. You can then convert DOS pathnames to Win32 pathnames and vice
versa.
HTH,
Ben
in message news:eihWpuc%
[email protected]...
function
that
It would be handy if they'd give us one that would compress a path to a
specified maximum number of characters, for display only.
I suppose I should do a systematic implementation of this myself,
instead
of
just the improvised one that I have now.