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

📄 modpath.bas

📁 vb编制的木马加花器
💻 BAS
字号:
Attribute VB_Name = "modPath"
'********************************************
''' 作者:kylinpoet or 獬独
''''2007-05-14 23:44 初稿
''''2007-05-15 13:32 修改
''''转载请保留作者 声明
'********************************************
Public Enum PathTypes
    FileName = 1                '文件名称+后缀
    JustName = 2                '文件名没有后缀
    FileExtension = 3           '文件后缀 没有 "."
    FilePath = 4                '文件路径 没有 "\"
    Drive = 5                   '盘符
    LastFolder = 6              '最后一个文件夹
    FirstFolder = 7             '第一个文件夹
    LastFolderAndFileName = 8   '最后一个文件夹加文件名称
    DriveAndFirstFolder = 9     '盘符+第一个文件夹名
    FullPath = 10               '完整路径
End Enum

Public Function GetPath(ByVal Path As String, Optional ByVal PathType As PathTypes = 1) As String
Dim strPath As String
Dim ThisType As PathTypes
Dim i As Integer
Dim j As Integer

strPath = Path

If InStr(strPath, "\") = 0 And InStr(strPath, ".") > 0 And InStr(strPath, ":") = 0 Then
    ThisType = FileName
ElseIf InStrRev(strPath, "\") = Len(strPath) And Len(strPath) > 3 Then
    ThisType = FilePath
ElseIf Len(strPath) = 3 And Mid(strPath, 2, 2) = ":\" Then
    ThisType = Drive
ElseIf Len(strPath) = 2 And Mid(strPath, 2, 1) = ":" Then
    ThisType = Drive
ElseIf InStrRev(strPath, "\") > InStrRev(strPath, ".") Then
    ThisType = JustName
ElseIf InStr(strPath, "\") > 0 And InStr(strPath, ".") > 0 Then
    ThisType = FullPath
Else
    Exit Function
End If

Select Case PathType
    Case 1
        If ThisType = FullPath Or ThisType = JustName Then
            GetPath = Right(strPath, Len(strPath) - InStrRev(strPath, "\"))
        ElseIf ThisType = FileName Then
            GetPath = strPath
        End If
    Case 2
        If ThisType = FullPath Then
            strPath = StrReverse(strPath)
            i = InStr(strPath, ".") + 1
            j = InStr(strPath, "\")
            strPath = Mid(strPath, i, j - i)
            GetPath = StrReverse(strPath)
        ElseIf ThisType = FileName Then
            GetPath = Left(strPath, InStrRev(strPath, ".") - 1)
        ElseIf ThisType = JustName Then
            GetPath = Right(strPath, Len(strPath) - InStrRev(strPath, "\"))
        End If
    Case 3
        If ThisType = FullPath Or ThisType = FileName Then
            GetPath = Right(strPath, Len(strPath) - InStrRev(strPath, "."))
        End If
    Case 4
        If ThisType = FullPath Or ThisType = JustName Then
            strPath = Left(strPath, InStrRev(strPath, "\") - 1)
        ElseIf ThisType = FilePath Then
            strPath = Left(strPath, Len(strPath) - 1)
        End If
        If Left(strPath, 1) = "\" Then
            strPath = Right(strPath, Len(strPath) - 1)
        End If
        GetPath = strPath
    Case 5
        If ThisType = FilePath Or ThisType = FullPath Or ThisType = Drive Or ThisType = JustName Then
            If Mid(strPath, 2, 1) = ":" Then
                GetPath = Left(strPath, 2)
            End If
        End If
    Case 6
        If ThisType = FullPath Or ThisType = JustName Or ThisType = FilePath Then
            strPath = Left(strPath, InStrRev(strPath, "\") - 1)
            GetPath = Right(strPath, Len(strPath) - InStrRev(strPath, "\"))
        End If
    Case 7
        If Mid(strPath, 2, 1) <> ":" And Left(strPath, 1) <> "\" Then
            strPath = "\" & strPath
        End If
        If ThisType = FullPath Or ThisType = JustName Or ThisType = FilePath Then
            strPath = Right(strPath, Len(strPath) - InStr(strPath, "\"))
            If InStr(strPath, "\") = 0 Then
                Exit Function
            End If
            GetPath = Left(strPath, InStr(strPath, "\") - 1)
        End If
    Case 8
        If ThisType = FullPath Or ThisType = JustName Then
            strPath = Left(strPath, InStrRev(strPath, "\") - 1)
            GetPath = Right(strPath, Len(strPath) - InStrRev(strPath, "\"))
            GetPath = GetPath & Right(Path, Len(Path) - InStrRev(Path, "\") + 1)
        End If
    Case 9
        If ThisType = FullPath Or ThisType = JustName Or ThisType = FilePath Then
            If Mid(strPath, 2, 1) = ":" Then
                strPath = Right(strPath, Len(strPath) - InStr(strPath, "\"))
                GetPath = Left(Path, 3) & Left(strPath, InStr(strPath, "\") - 1)
            End If
        End If
    Case 10
        GetPath = strPath
End Select
End Function

⌨️ 快捷键说明

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