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

📄 find.frm

📁 光盘管家
💻 FRM
📖 第 1 页 / 共 2 页
字号:
         Kill CdromName + ".fnd"
      End If
      fnum = FreeFile
      roots = MainForm.TreeView2.Nodes(1).Text
      Open CdromName + ".fnd" For Output As #fnum
      Print #fnum, FindString
      Print #fnum, roots
      Close fnum
       TreeView1.Nodes.Clear
       TreeView1.Nodes.Add , , roots, roots
       For yy = 2 To MainForm.TreeView2.Nodes.Count
          Label3.Caption = MainForm.TreeView2.Nodes(yy).Key
          If Check1.Value And Check2.Value Then '两样都找
             If InStr(1, UCase(MainForm.TreeView2.Nodes(yy).Text), UCase(FindString)) Then
                FoundOne = True
                Found = True
                FindFord MainForm.TreeView2.Nodes(yy).Key
             End If
          Else
             If Check1.Value Then '只找文件夹
                If Right(MainForm.TreeView2.Nodes(yy).Key, 1) = "\" Then '是文件夹
                   If InStr(1, UCase(MainForm.TreeView2.Nodes(yy).Text), UCase(FindString)) Then
                      FoundOne = True
                      Found = True
                      FindFord MainForm.TreeView2.Nodes(yy).Key
                   End If
                End If
            Else '只找文件
                If Check2.Value Then
                If Right(MainForm.TreeView2.Nodes(yy).Key, 1) <> "\" Then  '是文件夹
                   If InStr(1, UCase(MainForm.TreeView2.Nodes(yy).Text), UCase(FindString)) Then
                      FoundOne = True
                      Found = True
                      FindFord MainForm.TreeView2.Nodes(yy).Key
                   End If
                End If
                End If
            End If
          End If
      Next
      If FoundOne Then
         MainForm.TreeView1.Nodes.Add FindKey, tvwChild, FindKey + CdromName, CdromName, 1
         FoundOne = False
      End If
      '''************'''
      Next
      Label3.Caption = ""
      Me.MousePointer = 0
      Me.Caption = "查找"
      If Found = False Then
         Me.TreeView1.Nodes.Clear
         MsgBox "很遗憾,没找到待查字串 " + Chr(34) + FindString + Chr(34) + Chr(13) + Chr(13) + "你可以搜索整个光盘库或某个类别,如果你这样做了,还找不到!" + Chr(13) + "很遗憾,你没有这种光盘!", vbExclamation
         sfiles = Dir("*.fnd")
         Do While sfiles <> ""
            Kill sfiles
            sfiles = Dir
         Loop
         For i = 2 To MainForm.TreeView1.Nodes.Count
             If MainForm.TreeView1.Nodes(i).Key = FindKey Then
                MainForm.TreeView1.Nodes.Remove i
                Exit For
             End If
         Next
      Else
         MsgBox "恭喜,找到了待查字串 " + Chr(34) + FindString + Chr(34) + Chr(13) + Chr(13) + "请单击 查找结果 查看!", vbInformation
         For i = 2 To MainForm.TreeView1.Nodes.Count
             If MainForm.TreeView1.Nodes(i).Key = FindKey Then
                MainForm.TreeView1.Nodes(i).Expanded = True
                Exit For
             End If
         Next
      End If
      Unload Me
   ''''''''''''''''''''''''''''''''''''''''''''''''''''
   Else '单盘查找
       If Dir(CdromName + ".fnd") <> "" Then
          Kill CdromName + ".fnd"
       End If
       roots = MainForm.TreeView2.Nodes(1).Text
       fnum = FreeFile
       Open CdromName + ".fnd" For Output As #fnum
       Print #fnum, FindString
       Print #fnum, roots
       Close fnum
       TreeView1.Nodes.Add , , roots, roots
       For i = 2 To MainForm.TreeView2.Nodes.Count
          Label3.Caption = MainForm.TreeView2.Nodes(i).Key
          If Check1.Value And Check2.Value Then '两样都找
             If InStr(1, UCase(MainForm.TreeView2.Nodes(i).Text), UCase(FindString)) Then
                Found = True
                FindFord MainForm.TreeView2.Nodes(i).Key
             End If
          Else
             If Check1.Value Then '只找文件夹
                If Right(MainForm.TreeView2.Nodes(i).Key, 1) = "\" Then '是文件夹
                   If InStr(1, UCase(MainForm.TreeView2.Nodes(i).Text), UCase(FindString)) Then
                      Found = True
                      FindFord MainForm.TreeView2.Nodes(i).Key
                   End If
                End If
            Else '只找文件
                If Check2.Value Then
                If Right(MainForm.TreeView2.Nodes(i).Key, 1) <> "\" Then  '是文件夹
                   If InStr(1, UCase(MainForm.TreeView2.Nodes(i).Text), UCase(FindString)) Then
                      Found = True
                      FindFord MainForm.TreeView2.Nodes(i).Key
                   End If
                End If
                End If
            End If
          End If
      Next
      If Found Then
         FindKey = "@@@@@***##查找结果@@@@@***##"
         For i = 1 To MainForm.TreeView1.Nodes.Count
             If MainForm.TreeView1.Nodes(i).Key = FindKey Then
              If MainForm.TreeView1.Nodes(i).Children > 0 Then
                Set nox = MainForm.TreeView1.Nodes(i).Child
                For ii = 1 To MainForm.TreeView1.Nodes(i).Children
                   fname = nox.Text + ".fnd"
                    If Dir(fname) <> "" Then
                       If nox.Text <> CdromName Then
                          Kill fname
                       End If
                    End If
                    If ii < MainForm.TreeView1.Nodes(i).Children Then
                      Set nox = nox.Next
                    End If
                Next
             End If
                MainForm.TreeView1.Nodes.Remove i
                Exit For
             End If
         Next
         MainForm.TreeView1.Nodes.Add , , FindKey, "查找结果", 5
         MainForm.TreeView1.Nodes.Add FindKey, tvwChild, FindKey + CdromName, CdromName, 1
      End If
      Me.Caption = "查找"
      Me.MousePointer = 0
      If Found = False Then
         Me.TreeView1.Nodes.Clear
         sfiles = Dir("*.fnd")
         Do While sfiles <> ""
            Kill sfiles
            sfiles = Dir
         Loop
         For i = 2 To MainForm.TreeView1.Nodes.Count
             If MainForm.TreeView1.Nodes(i).Key = FindKey Then
                MainForm.TreeView1.Nodes.Remove i
                Exit For
             End If
         Next
         MsgBox "很遗憾,没找到待查字串 " + Chr(34) + FindString + Chr(34) + Chr(13) + Chr(13) + "你可以搜索整个光盘库或某个类别,如果你这样做了,还找不到!" + Chr(13) + "很遗憾,你没有这种光盘!", vbExclamation
       Else
         MsgBox "恭喜,找到了待查字串 " + Chr(34) + FindString + Chr(34) + Chr(13) + Chr(13) + "请单击" + Chr(34) + "查找结果" + Chr(34) + "查看!", vbInformation
         For i = 2 To MainForm.TreeView1.Nodes.Count
             If MainForm.TreeView1.Nodes(i).Key = FindKey Then
                MainForm.TreeView1.Nodes(i).Expanded = True
                Exit For
             End If
         Next
      End If
      Unload Me
   ''''''''''''''''''''''''''''''''''''''''''''''''
   End If
End Sub

Private Sub Command2_Click()
Unload Me
End Sub

Private Sub Form_Load()
CencerForm Me
Label2.Caption = Info
End Sub

Public Sub FindFord(sFoundString As String)
Dim sNodeText As String
Dim sNodeKey As String
Dim k As Single, j As Single, i As Single
fnum = FreeFile
fname = CdromName + ".fnd"
Open fname For Append As #fnum
   k = 1
   For i = 1 To Len(sFoundString)
       If Mid(sFoundString, i, 1) = "\" Then
              sNodeText = Mid(sFoundString, k, i - k)
              If Len(sNodeText) = 2 And Right(sNodeText, 1) = ":" Then
                 sNodeText = sNodeText + "\"
              End If
              sNodeKey = Left(sFoundString, i)
              You = False '列表中有无该键名
              For j = 1 To TreeView1.Nodes.Count
                  If TreeView1.Nodes(j).Key = sNodeKey Then
                     You = True
                  End If
              Next
              If Not You Then
                 fathernode = FindFather(sNodeKey, True)
                 Print #fnum, sNodeKey
                 TreeView1.Nodes.Add fathernode, tvwChild, sNodeKey, sNodeText
              End If
              k = i + 1
       End If
  Next
  If i = k Then
     Close fnum
     Exit Sub
  End If
  If i > 1 And k > 1 Then
     sNodeKey = sNodeKey + Mid(sFoundString, k)
     sNodeText = Mid(sFoundString, k)
     For i = Len(sNodeKey) To 1 Step -1
         If Mid(sNodeKey, i, 1) = "\" Then
            skey = Left(sNodeKey, i)
            Exit For
         End If
    Next
    Print #fnum, sNodeKey
    TreeView1.Nodes.Add skey, tvwChild, sNodeKey, sNodeText
  End If
  Close fnum
End Sub

Public Function FindFather(sFindString As String, Folder As Boolean) As String
If Folder Then
   ssFindString = Left(sFindString, Len(sFindString) - 1)
End If
For i = Len(ssFindString) To 1 Step -1
    If Mid(ssFindString, i, 1) = "\" Then
       FindFather = Left(ssFindString, i)
       Exit For
    End If
Next
If InStr(1, FindFather, "\") Then
Else
   FindFather = ssFindString
End If
End Function

⌨️ 快捷键说明

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