PLEASE HELP, PLEASE HELP, PLEASE HELP, PLEASE HELP, PLEASE HELP, PLEASE HELP, PLEASE HELP,
Ioan,
You can use the GetShortPathName API function to retrieve the short file
name from a long file name. Here is an example of converting a text file
named "LongFileName.txt" to it's short file name:
Private Declare Function GetShortPathName Lib "kernel32" Alias
"GetShortPathNameA" (ByVal lpszLongPath As String, ByVal lpszShortPath As
String, ByVal cchBuffer As Long) As Long
Private Sub Command1_Click()
Dim LongPath As String, ShortPath As String, Length As Long
LongPath = String(255, vbNullChar)
ShortPath = String(255, vbNullChar)
LongPath = App.Path & "\LongFileName.txt"
Length = GetShortPathName(LongPath, ShortPath, Len(ShortPath))
ShortPath = Left(ShortPath, Length)
MsgBox ShortPath
End Sub
In VB5's API Text Viewer the declaration for this API is incorrect. The
declaration I have above is correct.
Hope this helps,
Kerry Moorman
How do I convert a long file name to a short filename in V.B. 6. Or is`nt
it possible?
----------