Results 1 to 3 of 3

Thread: 8.3 DOS Path

  1. #1
    lord_dude
    Guest

    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

  2. #2
    PowerPoster
    Join Date
    Jul 1999
    Posts
    5,923
    It's the GetShortPathName API...
    VB Code:
    1. Declare Function GetShortPathName Lib "kernel32" Alias "GetShortPathNameA" (ByVal lpszLongPath As String, ByVal lpszShortPath As String, ByVal cchBuffer As Long) As Long

  3. #3
    Matthew Gates
    Guest
    This is it's uage.


    VB Code:
    1. Private Declare Function GetShortPathName _
    2. Lib "kernel32" Alias "GetShortPathNameA" (ByVal _
    3. lpszLongPath As String, ByVal lpszShortPath As String, _
    4. ByVal cchBuffer As Long) As Long
    5.  
    6.  
    7. Private Function GetShortFilename(ByVal sLongFilename As String) As String
    8.    
    9.     Dim lRet As Long
    10.     Dim sShortFilename As String
    11.     sShortFilename = String$(1024, " ")
    12.     lRet = GetShortPathName(sLongFilename, sShortFilename, Len(sShortFilename))
    13.    
    14.  
    15.  
    16.     If lRet > Len(sShortFilename) Then
    17.         sShortFilename = String$(lRet + 1, " ")
    18.         lRet = GetShortPathName(sLongFilename, sShortFilename, Len(sShortFilename))
    19.     End If
    20.  
    21.     If lRet > 0 Then
    22.         GetShortFilename = Left$(sShortFilename, lRet)
    23.     End If
    24.    
    25. 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
  •  



Click Here to Expand Forum to Full Width