-
How do I retrieve the old MS-DOS type filename (blahbl~2.bla) from a selected file in a filebox? I could use the Left() function, but that wouldn't work if there were more than one files with the same first six letters and same extension. Is there a special API call that I could use? I'm unfamiliar with the Windows API. I've used it before, but not much.
Thanks,
Malduin
VB6.0 Professional Ed.
-
Use the GetShortPathName function:
Code:
Private Declare Function GetShortPathName Lib "kernel32" Alias "GetShortPathNameA" (ByVal lpszLongPath As String, ByVal lpszShortPath As String, ByVal cchBuffer As Long) As Long
Const MAX_PATH = 260
Private Sub Form_Load()
Dim sShortName As String * MAX_PATH
GetShortPathName "C:\Program Files", sShortName, MAX_PATH
MsgBox sShortName
End Sub