|
-
Jul 13th, 2001, 02:45 PM
#1
8.3 DOS Path
There an api function that converts a windows file path to an 8.3 DOS one, eg, "C:\program files" to "C:\progra~1" but i have forgotten what it is called. Does anyone know, and/or have the declaration for it?
Thanks
-
Jul 13th, 2001, 02:55 PM
#2
PowerPoster
It's the GetShortPathName API...
VB Code:
Declare Function GetShortPathName Lib "kernel32" Alias "GetShortPathNameA" (ByVal lpszLongPath As String, ByVal lpszShortPath As String, ByVal cchBuffer As Long) As Long
-
Jul 14th, 2001, 12:17 AM
#3
This is it's uage.
VB Code:
Private Declare Function GetShortPathName _
Lib "kernel32" Alias "GetShortPathNameA" (ByVal _
lpszLongPath As String, ByVal lpszShortPath As String, _
ByVal cchBuffer As Long) As Long
Private Function GetShortFilename(ByVal sLongFilename As String) As String
Dim lRet As Long
Dim sShortFilename As String
sShortFilename = String$(1024, " ")
lRet = GetShortPathName(sLongFilename, sShortFilename, Len(sShortFilename))
If lRet > Len(sShortFilename) Then
sShortFilename = String$(lRet + 1, " ")
lRet = GetShortPathName(sLongFilename, sShortFilename, Len(sShortFilename))
End If
If lRet > 0 Then
GetShortFilename = Left$(sShortFilename, lRet)
End If
End Sub
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
|