GetShortPathName
Esta función la podemos usar para convertir
un nombre largo en uno corto (tipo MS-DOS 8.3).
Ejemplos para VB6 y Visual Basic .NET
y C#
Declaración en el API de Windows:
DWORD GetShortPathName(
LPCTSTR lpszLongPath, // pointer to a null-terminated path string
LPTSTR lpszShortPath, // pointer to a buffer to receive the
// null-terminated short form of the path
DWORD cchBuffer // specifies the size of the buffer pointed
// to by lpszShortPath
);
Declaración para VB6:
Private Declare Function GetShortPathName Lib "kernel32" Alias "GetShortPathNameA" _
(ByVal lpszLongPath As String, _
ByVal lpszShortPath As String, _
ByVal cchBuffer As Long) As Long
Declaración
para VB .NET:
<System.Runtime.InteropServices.DllImport("kernel32.dll")> _
Private Shared Function GetShortPathName( _
ByVal lpszLongPath As String, _
ByVal lpszShortPath As System.Text.StringBuilder, _
ByVal cchBuffer As Integer) As Integer
End Function
Declaración
para C#:
[System.Runtime.InteropServices.DllImport("kernel32.dll")]
private extern static int GetShortPathName(
string lpszLongPath,
System.Text.StringBuilder lpszShortPath,
int cchBuffer);