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

📄 form3.frm

📁 P2P文件共享系统,新手入门建议下载阅读.
💻 FRM
📖 第 1 页 / 共 2 页
字号:
                        .Col = J
                        Form1.MSFlexGrid2.Row = Form1.MSFlexGrid2.Rows - 1
                        Form1.MSFlexGrid2.Col = J
                        Form1.MSFlexGrid2.Text = .Text
                    Next J
                End If
            Next i
        ElseIf Form1.Option1.Value = True Then
RestartLoop2:
            Form1.MSFlexGrid2.Rows = 1
            For i = 1 To .Rows - 1
                .Col = 0
                .Row = i
                If InStr(1, LCase(.Text), LCase(Form1.Text1.Text), vbTextCompare) Then
                    .CellFontBold = True
                    Form1.MSFlexGrid2.Rows = Form1.MSFlexGrid2.Rows + 1
                    For J = 0 To .Cols - 1
                        .Col = J
                        Form1.MSFlexGrid2.Row = Form1.MSFlexGrid2.Rows - 1
                        Form1.MSFlexGrid2.Col = J
                        Form1.MSFlexGrid2.Text = .Text
                    Next J
                    .Col = 0
                End If
            Next i
        End If
    End With
Label2.Caption = "Complete"
Command1_Click
End Sub

Private Sub Command5_Click()
Unload Me
End Sub

Private Sub Command6_Click()
MSFlexGrid1.Row = MSFlexGrid1.Row + 1
CancelIt:
Inet1.Cancel
Timer1.Interval = 1
End Sub

Private Sub Form_Activate()
'If SearchForWhat <> "" Then Form_Load
'SearchForWhat = ""
End Sub

Private Sub Form_Load()
MSFlexGrid1.Clear
MSFlexGrid1.Rows = 1
MSFlexGrid2.Clear
MSFlexGrid2.Rows = 1
With MSFlexGrid1
    .ColWidth(0) = .Width / 2
    .ColWidth(1) = .Width / 2
    .ScrollBars = flexScrollBarVertical
    .Rows = 1
    .Row = 0
    .Col = 0
    .Text = "Username"
    .CellFontBold = True
    .Col = 1
    .Text = "Address"
    .CellFontBold = True
    .CellAlignment = 0
End With
With MSFlexGrid2
    .ColWidth(0) = .Width - .ColWidth(1) * 3
    .ColWidth(5) = .Width * 1000
    .Row = 0
    .Col = 0
    .Text = "FileName"
    .CellFontBold = True
    .Col = 1
    .Text = "Size"
    .CellFontBold = True
    .Col = 2
    .Text = "Download Time"
    .CellFontBold = True
    .Col = 3
    .Text = "User"
    .CellFontBold = True
    .Col = 4
    .Text = "URL"
    .CellFontBold = True
    .Rows = 1
End With

End Sub

Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
If UnloadMode = 0 Then
    Me.Hide
    Form1.Changed = False
    Cancel = 1
End If
End Sub

Private Sub MSFlexGrid1_Click()
Timer1.Enabled = True
End Sub

Private Sub Timer1_Timer()
On Error Resume Next
If Inet1.StillExecuting = False Then
    T = "http://" & MSFlexGrid1.Text & ":1214"
    If MSFlexGrid1.Row + 1 >= MSFlexGrid1.Rows - 1 Then
        Command4_Click
    Else
        Dim SPEED, StartSeconds, StartMinutes, StartHours, EndSeconds, EndMinutes, EndHours, TotalSeconds, TotalMinutes, TotalHours
        MSFlexGrid1.Row = MSFlexGrid1.Row + 1
        MSFlexGrid1.Col = 0
        List1.Clear
        Temp1 = Time
        MSFlexGrid1.Col = 1
        Err.Number = 0
        T = "http://" & MSFlexGrid1.Text & ":1214"
        If Form1.Check1.Value = 1 Then
            Open App.Path & "\Cache\" & MSFlexGrid1.Text & ".tmp" For Input As #1
                If Err.Number = 76 Then
                    MkDir App.Path & "\Cache"
                    GoTo GetList
                ElseIf Err.Number = 53 Then GoTo GetList
                ElseIf Err.Number = 0 Then Label2.Caption = "Reading Cache: " & MSFlexGrid1.Text
                End If
                i = 0
                Do While Not EOF(1)
                    Line Input #1, strtextline
                    If i = 1 And strtextline <> Chr(34) And strtextline <> "" And strtextline <> vbCrLf And strtextline <> Chr(10) And strtextline <> Chr(13) Then List1.AddItem strtextline
                    i = 1
                Loop
            Close #1
        End If
        If List1.ListCount > 0 Then
            GoTo AlreadyCached
        Else
GetList:
            MSFlexGrid1.Col = 0
            Label2.Caption = "Reading " & MSFlexGrid1.Text
            MSFlexGrid1.Col = 1
            Text1.Text = Inet1.OpenURL("http://" & MSFlexGrid1.Text & ":1214")
            T = "http://" & MSFlexGrid1.Text & ":1214"
        End If
        Temp2 = Time
            
        MSFlexGrid1.Col = 0
            
        StartSeconds = Left(Right(Temp1, 5), 2)
        StartMinutes = Left(Right(Temp1, 8), 2)
        StartHours = Left(Temp1, 2)
                        
        EndSeconds = Left(Right(Temp2, 5), 2)
        EndMinutes = Left(Right(Temp2, 8), 2)
        EndHours = Left(Temp2, 2)
            
        TotalSeconds = EndSeconds - StartSeconds
        TotalMinutes = EndMinutes - StartMinutes
        TotalHours = EndHours - StartHours
            
        TotalMinutes = TotalMinutes + (TotalHours * 60) + (TotalSeconds / 60)
        TotalSeconds = TotalMinutes * 60
        TotalHours = TotalMinutes / 60
        Label2.Caption = "Converting Data"
        SPEED = (((1 / (TotalSeconds + 1)) * Len(Text1.Text)) / 1034) * 4
                Text1.Text = Replace(Text1.Text, Chr(10), vbCrLf, 1, Len(Text1.Text), vbTextCompare)
                Text1.Text = Replace(Text1.Text, "<tr><td><a href=", vbCrLf, 1, Len(Text1.Text), vbTextCompare)
                Text1.Text = Replace(Text1.Text, Chr(34) & ">", vbCrLf, 1, Len(Text1.Text), vbTextCompare)
                Text1.Text = Replace(Text1.Text, Chr(34), "", 1, Len(Text1.Text), vbTextCompare)
                Text1.Text = Replace(Text1.Text, "</a><td>", vbCrLf, 1, Len(Text1.Text), vbTextCompare)
                Text1.Text = Replace(Text1.Text, "<html><body><table>", "", 1, Len(Text1.Text), vbTextCompare)
                Text1.Text = Replace(Text1.Text, "</table></body></html>", "", 1, Len(Text1.Text), vbTextCompare)
                Text1.Text = Replace(Text1.Text, vbCrLf & vbCrLf, vbCrLf, 1, Len(Text1.Text), vbTextCompare)
        MSFlexGrid1.Col = 1
        If Form1.Check1.Value = 1 Then
            Open App.Path & "\Cache\" & MSFlexGrid1.Text & ".tmp" For Output As #1
                Write #1, vbCrLf & Text1.Text & vbCrLf
            Close #1
            List1.Clear
            Open App.Path & "\Cache\" & MSFlexGrid1.Text & ".tmp" For Input As #1
                i = 0
                Do While Not EOF(1)
                    Line Input #1, strtextline
                    If i = 1 And strtextline <> Chr(34) And strtextline <> "" And strtextline <> vbCrLf And strtextline <> Chr(10) And strtextline <> Chr(13) Then List1.AddItem strtextline
                    i = 1
                Loop
            Close #1
        Else
            Open App.Path & "\Cache\Temp.tmp" For Output As #1
                Write #1, vbCrLf & Text1.Text & vbCrLf
            Close #1
            List1.Clear
            Open App.Path & "\Cache\Temp.tmp" For Input As #1
                i = 0
                Do While Not EOF(1)
                    Line Input #1, strtextline
                    If i = 1 And strtextline <> Chr(34) And strtextline <> "" And strtextline <> vbCrLf And strtextline <> Chr(10) And strtextline <> Chr(13) Then List1.AddItem strtextline
                    i = 1
                Loop
            Close #1
            Kill App.Path & "\Cache\Temp.tmp"
        End If
        MSFlexGrid1.Col = 0
AlreadyCached:
        With MSFlexGrid2
            Temp = .Rows - 1
                
            .Row = Temp
            For i = 0 To List1.ListCount Step 3
                With MSFlexGrid2
                    .Rows = .Rows + 1
                    .Row = .Rows - 1
                    .Col = 4
                    .Text = T & List1.List(i)
                    .CellFontBold = False
                    .CellAlignment = 0
                    .Col = 3
                    MSFlexGrid1.Col = 0
                    .Text = MSFlexGrid1.Text
                    .Col = 4
                    MSFlexGrid1.Col = 1
                End With
            Next i
            .Row = Temp
            For i = 1 To List1.ListCount Step 3
                If MSFlexGrid1.Row + 1 > MSFlexGrid1.Rows - 1 Then .Row = .Row + 1
                .Col = 0
                .Row = .Row + 1
                .Text = List1.List(i)
                .CellFontBold = False
                .CellAlignment = 0
            Next i
            .Row = Temp
            For i = 2 To List1.ListCount Step 3
                .Row = .Row + 1
                .Col = 2
                Secs = Int((List1.List(i) / SPEED) / 1034.368)
                Mins = 0
                Do While Secs >= 60
                    Mins = Mins + 1
                    Secs = Secs - 60
                Loop
                Do While Mins >= 60
                    Hours = Hours + 1
                    Mins = Mins - 60
                Loop
                If Len(Secs) = 1 Then Secs = "0" & Secs
                If Hours > 0 Then
                    If Len(Mins) = 1 Then Mins = "0" & Mins
                    .Text = Hours & ":" & Mins & ":" & Secs
                ElseIf Hours <= 0 Then
                    .Text = Mins & ":" & Secs
                ElseIf Hours <= 0 And Mins <= 0 Then
                    .Text = Secs & " seconds."
                End If
                .Col = 1
                If List1.List(i) / 1024.368 < 1000 Then
                    .Text = Round(List1.List(i) / 1024.368, 2) & " kb"
                Else
                    .Text = Round(List1.List(i) / 1024368, 2) & " mb"
                End If
                .CellFontBold = False
                .CellAlignment = 0
            Next i
        End With
    End If
End If
End Sub

⌨️ 快捷键说明

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