Results 1 to 2 of 2

Thread: Is this possible ?

  1. #1

    Thread Starter
    Member
    Join Date
    Oct 2000
    Location
    Belgrade,Yugoslavia
    Posts
    34

    Thumbs up

    How can I retrieve long file and path names from short file and path names ?
    I have a problem with my app. When I double click the associated file it only retrieve the shorth path name. WHY ??
    Thanks in advance !

  2. #2
    Junior Member
    Join Date
    Oct 2000
    Posts
    20
    Public Function GetLongName(sShortName As String) As String
    Dim sTemp As String
    Dim sNew As String
    Dim iHasBS As Integer
    Dim iBS As Integer
    If Len(sShortName) = 0 Then Exit Function
    sTemp = sShortName

    If Right$(sTemp, 1) = "\" Then
    sTemp = Left$(sTemp, Len(sTemp) - 1)
    iHasBS = True
    End If

    On Error GoTo MSGLFNnofile
    If InStr(sTemp, "\") Then
    sNew = ""
    Do While InStr(sTemp, "\")
    If Len(sNew) Then
    sNew = Dir$(sTemp, 54) & "\" & sNew
    Else
    sNew = Dir$(sTemp, 54)
    If sNew = "" Then
    GetLongName = sShortName
    Exit Function
    End If
    End If

    On Error Resume Next
    For iBS = Len(sTemp) To 1 Step -1
    If ("\" = Mid$(sTemp, iBS, 1)) Then
    'found it
    Exit For
    End If
    Next iBS
    sTemp = Left$(sTemp, iBS - 1)
    Loop
    sNew = sTemp & "\" & sNew
    Else
    sNew = Dir$(sTemp, 54)
    End If
    MSGLFNresume:
    If iHasBS Then
    sNew = sNew & "\"
    End If
    GetLongName = sNew
    Exit Function
    MSGLFNnofile:
    sNew = ""
    Resume MSGLFNresume
    End Function

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