There an api function that converts a windows file path to an 8.3 DOS one, eg, "C:\program files" to "C:\progra~1" but i have forgotten what it is called. Does anyone know, and/or have the declaration for it?
Thanks
Printable View
There an api function that converts a windows file path to an 8.3 DOS one, eg, "C:\program files" to "C:\progra~1" but i have forgotten what it is called. Does anyone know, and/or have the declaration for it?
Thanks
It's the GetShortPathName API...VB Code:
Declare Function GetShortPathName Lib "kernel32" Alias "GetShortPathNameA" (ByVal lpszLongPath As String, ByVal lpszShortPath As String, ByVal cchBuffer As Long) As Long
This is it's uage.
VB Code:
Private Declare Function GetShortPathName _ Lib "kernel32" Alias "GetShortPathNameA" (ByVal _ lpszLongPath As String, ByVal lpszShortPath As String, _ ByVal cchBuffer As Long) As Long Private Function GetShortFilename(ByVal sLongFilename As String) As String Dim lRet As Long Dim sShortFilename As String sShortFilename = String$(1024, " ") lRet = GetShortPathName(sLongFilename, sShortFilename, Len(sShortFilename)) If lRet > Len(sShortFilename) Then sShortFilename = String$(lRet + 1, " ") lRet = GetShortPathName(sLongFilename, sShortFilename, Len(sShortFilename)) End If If lRet > 0 Then GetShortFilename = Left$(sShortFilename, lRet) End If End Sub