I've got a program that doesn't open files with excessively long filenames.
Is there a way of finding out what the actual 8.3 character filename is...
(i.e. "longfi~1.jpg" instead of "long filename.jpg")
Printable View
I've got a program that doesn't open files with excessively long filenames.
Is there a way of finding out what the actual 8.3 character filename is...
(i.e. "longfi~1.jpg" instead of "long filename.jpg")
Type this in a module;
Private Declare Function GetShortPathName Lib "kernel32" Alias "GetShortPathNameA" (ByVal lpszLongPath As String, ByVal lpszShortPath As String, ByVal lBuffer As Long) As Long
Function GetShortPath(strFilename As String) As String
Dim lngres As Long
Dim strPath As String
strPath = String$(165, 0)
lngres = GetShortPathName(strFilename, strPath, 164)
GetShortPath = Left$(strPath, lngres)
End Function
Then use
ShortFileName = GetShortPath("this is the long filename.doc")
Voila.
Cheers Buzby...
Any ideas of how to get it to work in NT4 aswell?
Ta!
Stevie P
I suspect the only difference is the API call declaration - check out www.vbapi.com for more info.
What is the exact path you are sending to the function?
Cause it works for me