mart37
Nov 1st, 2000, 07:07 AM
Is there a good API function that can give you a folder 's name in ms-dos
EXAMPLE: the folder Program files is named PROGRAM~1 in dos.
Orpheus
Nov 1st, 2000, 08:26 AM
Private Declare Function GetShortPathName Lib "kernel32" Alias "GetShortPathNameA" (ByVal lpszLongPath As String, ByVal lpszShortPath As String, ByVal cchBuffer As Long) As Long
Private Const MAX_PATH = 260
function shortname(strLongPath as string) as string
Dim strPath As String, intPathLen As Integer
strPath = Space$(MAX_PATH)
intPathLen = GetShortPathName(strLongPath, strPath, MAX_PATH)
shortname = Left(strPath, intPathLen)
end function
You will have to provide the eror checking, but here is a basis to start from.