⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 getlongfilename.txt

📁 一部分关于VB编程的小技巧
💻 TXT
字号:
'*Gets long filename from ms-dos filename!

Function GetLongFilename(strShortName As String) As String
    On Error Resume Next

    Dim strTemp As String   'Temporary String Holder
    Dim strNew As String    'Hold New String
    Dim intHasBS As Integer 'Has Back Slash Flag
    Dim intBS As Integer    'Back Slash Position
    If Len(strShortName) = 0 Then Exit Function
    strTemp = strShortName


    If Right$(strTemp, 1) = "\" Then
        strTemp = Left$(strTemp, Len(strTemp) - 1)
        intHasBS = True
    End If
    On Error GoTo MSGLFNnofile

    If InStr(strTemp, "\") Then
        strNew = ""

        Do While InStr(strTemp, "\")

            If Len(strNew) Then
                strNew = Dir$(strTemp, 54) & "\" & strNew
            Else
                strNew = Dir$(strTemp, 54)

                If strNew = "" Then
                    GetLongFilename = strShortName
                    Exit Function
                End If
            End If
            On Error Resume Next

            For intBS = Len(strTemp) To 1 Step -1
                If ("\" = Mid$(strTemp, intBS, 1)) Then
                    'found it
                    Exit For
                End If
            Next intBS
            strTemp = Left$(strTemp, intBS - 1)
        Loop
        strNew = strTemp & "\" & strNew
    Else
        strNew = Dir$(strTemp, 54)
    End If

MSGLFNresume:
    If intHasBS Then
        strNew = strNew & "\"
    End If
    GetLongFilename = strNew
    Exit Function

MSGLFNnofile:
    strNew = ""
    Resume MSGLFNresume
End Function

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -