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

📄 frmmain.frm

📁 本书源码主要针对目前流行的FTP、HTTP、E-mail、Telnet、ICMP、Modem串口通信编程、拨号网络编程等内容进行详细的讲解
💻 FRM
📖 第 1 页 / 共 2 页
字号:
VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "COMDLG32.OCX"
Begin VB.Form frmMain 
   BorderStyle     =   1  'Fixed Single
   Caption         =   "WebSite Down"
   ClientHeight    =   6705
   ClientLeft      =   45
   ClientTop       =   330
   ClientWidth     =   9900
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   6705
   ScaleWidth      =   9900
   StartUpPosition =   3  'Windows Default
   Begin VB.ListBox lstReferences 
      BackColor       =   &H00C0FFFF&
      ForeColor       =   &H00800000&
      Height          =   3180
      Left            =   6960
      TabIndex        =   8
      Top             =   420
      Width           =   2835
   End
   Begin VB.ListBox lstImages 
      BackColor       =   &H00C0FFFF&
      ForeColor       =   &H00800000&
      Height          =   2205
      Left            =   6960
      TabIndex        =   7
      Top             =   4080
      Width           =   2880
   End
   Begin MSComctlLib.StatusBar SBar1 
      Align           =   2  'Align Bottom
      Height          =   315
      Left            =   0
      TabIndex        =   6
      Top             =   6390
      Width           =   9900
      _ExtentX        =   17463
      _ExtentY        =   556
      _Version        =   393216
      BeginProperty Panels {8E3867A5-8586-11D1-B16A-00C0F0283628} 
         NumPanels       =   3
         BeginProperty Panel1 {8E3867AB-8586-11D1-B16A-00C0F0283628} 
            AutoSize        =   1
            Object.Width           =   8767
            MinWidth        =   6068
         EndProperty
         BeginProperty Panel2 {8E3867AB-8586-11D1-B16A-00C0F0283628} 
            Object.Width           =   6068
            MinWidth        =   6068
         EndProperty
         BeginProperty Panel3 {8E3867AB-8586-11D1-B16A-00C0F0283628} 
            Style           =   5
            Alignment       =   2
            TextSave        =   "21:39"
         EndProperty
      EndProperty
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "幼圆"
         Size            =   9.75
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
   End
   Begin VB.Frame Frame1 
      Caption         =   "下载任务"
      BeginProperty Font 
         Name            =   "幼圆"
         Size            =   9.75
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   2295
      Left            =   60
      TabIndex        =   1
      Top             =   60
      Width           =   6792
      Begin VB.TextBox txtInfo 
         Appearance      =   0  'Flat
         BackColor       =   &H00FFFFC0&
         BeginProperty Font 
            Name            =   "幼圆"
            Size            =   9.75
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H000000C0&
         Height          =   1095
         Left            =   1500
         MultiLine       =   -1  'True
         TabIndex        =   10
         Top             =   1020
         Width           =   5175
      End
      Begin MSComDlg.CommonDialog CDlg 
         Left            =   5940
         Top             =   1440
         _ExtentX        =   847
         _ExtentY        =   847
         _Version        =   393216
      End
      Begin VB.CommandButton cmdStart 
         Caption         =   "打开下载"
         BeginProperty Font 
            Name            =   "幼圆"
            Size            =   9.75
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   312
         Index           =   2
         Left            =   240
         TabIndex        =   9
         Top             =   1620
         Width           =   1032
      End
      Begin VB.TextBox txtUrl 
         Appearance      =   0  'Flat
         BackColor       =   &H00C0FFC0&
         BeginProperty Font 
            Name            =   "幼圆"
            Size            =   9.75
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H000000FF&
         Height          =   312
         Left            =   2520
         TabIndex        =   4
         Text            =   "http://10.11.111.119"
         Top             =   300
         Width           =   4155
      End
      Begin VB.CommandButton cmdStart 
         Caption         =   "停止下载"
         BeginProperty Font 
            Name            =   "幼圆"
            Size            =   9.75
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   312
         Index           =   1
         Left            =   240
         TabIndex        =   3
         Top             =   1080
         Width           =   1032
      End
      Begin VB.CommandButton cmdStart 
         Caption         =   "加入下载"
         BeginProperty Font 
            Name            =   "幼圆"
            Size            =   9.75
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   312
         Index           =   0
         Left            =   240
         TabIndex        =   2
         Top             =   300
         Width           =   1032
      End
      Begin VB.Label Label2 
         Caption         =   "下载信息:"
         BeginProperty Font 
            Name            =   "MS Sans Serif"
            Size            =   9.75
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   315
         Left            =   1440
         TabIndex        =   11
         Top             =   720
         Width           =   2775
      End
      Begin VB.Label Label1 
         Caption         =   "起始URL:"
         BeginProperty Font 
            Name            =   "MS Sans Serif"
            Size            =   9.75
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   195
         Left            =   1500
         TabIndex        =   5
         Top             =   360
         Width           =   915
      End
   End
   Begin MSComctlLib.ImageList ImageList1 
      Left            =   480
      Top             =   1620
      _ExtentX        =   794
      _ExtentY        =   794
      BackColor       =   -2147483643
      ImageWidth      =   16
      ImageHeight     =   16
      MaskColor       =   12632256
      _Version        =   393216
      BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628} 
         NumListImages   =   2
         BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmMain.frx":0000
            Key             =   "html"
         EndProperty
         BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmMain.frx":0454
            Key             =   "img"
         EndProperty
      EndProperty
   End
   Begin MSComctlLib.ListView LView 
      Height          =   3855
      Left            =   60
      TabIndex        =   0
      Top             =   2520
      Width           =   6795
      _ExtentX        =   11986
      _ExtentY        =   6800
      View            =   2
      LabelWrap       =   -1  'True
      HideSelection   =   -1  'True
      _Version        =   393217
      Icons           =   "ImageList1"
      SmallIcons      =   "ImageList1"
      ColHdrIcons     =   "ImageList1"
      ForeColor       =   32768
      BackColor       =   12648384
      BorderStyle     =   1
      Appearance      =   1
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "幼圆"
         Size            =   9.75
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      NumItems        =   1
      BeginProperty ColumnHeader(1) {BDD1F052-858B-11D1-B16A-00C0F0283628} 
         Object.Width           =   2540
      EndProperty
   End
   Begin VB.Label Label4 
      Caption         =   "BINARY文件 URL"
      BeginProperty Font 
         Name            =   "幼圆"
         Size            =   9.75
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H000000C0&
      Height          =   255
      Left            =   6960
      TabIndex        =   13
      Top             =   3720
      Width           =   1935
   End
   Begin VB.Label Label3 
      Caption         =   "ASCII文件 URL"
      BeginProperty Font 
         Name            =   "幼圆"
         Size            =   9.75
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H000000C0&
      Height          =   255
      Left            =   7020
      TabIndex        =   12
      Top             =   120
      Width           =   1935
   End
End
Attribute VB_Name = "frmMain"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Const scBlankStr = ""   '定义空字符串常量
Dim objNetGet       As New ClsNetGet '定义类对象
Dim colReferences   As New Collection '定义存储链接(href)的集合
Dim colImages       As New Collection '定义存储链接(src)的集合
Dim vReference      As Variant
Dim sHost           As String         '请求的Server地址
Dim SaveFilePath    As String         '保存下载文件的文件夹
Dim SaveFileName    As String         '保存下载信息的文件
Dim sStartUrl       As String         '起始url
Dim bCancel         As Boolean        '取消下载的标志
Dim ReadNum         As Long           '下载文件记数

'该按扭数组事件用于开始新下载,继续和停止下载,打开下载
Private Sub cmdStart_Click(Index As Integer)
On Error GoTo err1:
If Index = 0 Then
    '选择保存下载文件的目录和保存下载信息的文件
    CDlg.Filter = "*.web"
    CDlg.FileName = "*.web"
    CDlg.ShowSave
    '取消则退出该过程
    If Right(CDlg.FileName, 4) <> ".web" Then GoTo err1
    '保存下载信息的文件
    SaveFileName = CDlg.FileName
    '从保存下载信息的文件中取得保存下载文件的目录
    SaveFilePath = Left(CDlg.FileName, Len(CDlg.FileName) - 4)
    If Dir(SaveFilePath, vbDirectory) = "" Then
        '如果目录不存在,创建目录
        MkDir SaveFilePath
    End If
    '清除文件链接的ListBox
    lstReferences.Clear
    lstImages.Clear
    '清除已下载文件的ListView
    LView.ListItems.Clear
    sStartUrl = txtUrl.Text
    '显示下载设置信息
    txtInfo.Text = "下载起始URL:" & sStartUrl & vbCrLf
    txtInfo.Text = txtInfo.Text & "保存路径:   " & SaveFilePath & vbCrLf
    txtInfo.Text = txtInfo.Text & "信息文件:   " & SaveFileName & vbCrLf
    txtInfo.Text = txtInfo.Text & "下载文件类型:*.EXE *.HTM *.HTML *.ZIP *.GIF * JPG"
    '从起始网页开始下载文件
    bCancel = False
    If StartGet(sStartUrl) = True Then
        cmdStart(1).Caption = "停止下载"
        cmdStart(1).Enabled = True
        cmdStart(0).Enabled = False
        cmdStart(2).Enabled = False
        ReadNum = 0

⌨️ 快捷键说明

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