|
-
Feb 27th, 2000, 06:50 PM
#1
Thread Starter
Member
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")
-
Feb 27th, 2000, 09:07 PM
#2
Frenzied Member
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.
'Buzby'
Visual Basic Developer
"I'm moving to Theory. Everything works there."
-
Feb 28th, 2000, 08:14 PM
#3
Thread Starter
Member
Cheers Buzby...
Any ideas of how to get it to work in NT4 aswell?
Ta!
Stevie P
-
Feb 28th, 2000, 08:50 PM
#4
Frenzied Member
I suspect the only difference is the API call declaration - check out www.vbapi.com for more info.
'Buzby'
Visual Basic Developer
"I'm moving to Theory. Everything works there."
-
Feb 28th, 2000, 10:06 PM
#5
What is the exact path you are sending to the function?
Cause it works for me
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|