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

📄 web.frm

📁 一个网络编程的好例子哦 很好用
💻 FRM
字号:
VERSION 5.00
Object = "{EAB22AC0-30C1-11CF-A7EB-0000C05BAE0B}#1.1#0"; "shdocvw.dll"
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 Form1 
   Caption         =   "浏览器"
   ClientHeight    =   4920
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   6090
   LinkTopic       =   "Form1"
   ScaleHeight     =   4920
   ScaleWidth      =   6090
   StartUpPosition =   3  '窗口缺省
   Begin VB.Timer Timer1 
      Interval        =   10
      Left            =   5400
      Top             =   1320
   End
   Begin MSComDlg.CommonDialog CommonDialog1 
      Left            =   3600
      Top             =   1080
      _ExtentX        =   847
      _ExtentY        =   847
      _Version        =   393216
   End
   Begin MSComctlLib.StatusBar StatusBar1 
      Align           =   2  'Align Bottom
      Height          =   375
      Left            =   0
      TabIndex        =   3
      Top             =   4545
      Width           =   6090
      _ExtentX        =   10742
      _ExtentY        =   661
      _Version        =   393216
      BeginProperty Panels {8E3867A5-8586-11D1-B16A-00C0F0283628} 
         NumPanels       =   3
         BeginProperty Panel1 {8E3867AB-8586-11D1-B16A-00C0F0283628} 
         EndProperty
         BeginProperty Panel2 {8E3867AB-8586-11D1-B16A-00C0F0283628} 
         EndProperty
         BeginProperty Panel3 {8E3867AB-8586-11D1-B16A-00C0F0283628} 
         EndProperty
      EndProperty
   End
   Begin VB.ComboBox Combo1 
      Height          =   315
      Left            =   1560
      TabIndex        =   2
      Text            =   "Combo1"
      Top             =   840
      Width           =   1695
   End
   Begin MSComctlLib.ImageList ImageList1 
      Left            =   4560
      Top             =   1080
      _ExtentX        =   1005
      _ExtentY        =   1005
      BackColor       =   -2147483643
      ImageWidth      =   32
      ImageHeight     =   32
      MaskColor       =   12632256
      _Version        =   393216
      BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628} 
         NumListImages   =   8
         BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "web.frx":0000
            Key             =   ""
         EndProperty
         BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "web.frx":031C
            Key             =   ""
         EndProperty
         BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "web.frx":0638
            Key             =   ""
         EndProperty
         BeginProperty ListImage4 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "web.frx":0954
            Key             =   ""
         EndProperty
         BeginProperty ListImage5 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "web.frx":0C70
            Key             =   ""
         EndProperty
         BeginProperty ListImage6 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "web.frx":0F8C
            Key             =   ""
         EndProperty
         BeginProperty ListImage7 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "web.frx":12A8
            Key             =   ""
         EndProperty
         BeginProperty ListImage8 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "web.frx":15C4
            Key             =   ""
         EndProperty
      EndProperty
   End
   Begin MSComctlLib.Toolbar Toolbar1 
      Align           =   1  'Align Top
      Height          =   855
      Left            =   0
      TabIndex        =   1
      Top             =   0
      Width           =   6090
      _ExtentX        =   10742
      _ExtentY        =   1508
      ButtonWidth     =   1296
      ButtonHeight    =   1349
      Appearance      =   1
      ImageList       =   "ImageList1"
      DisabledImageList=   "ImageList1"
      HotImageList    =   "ImageList1"
      _Version        =   393216
      BeginProperty Buttons {66833FE8-8583-11D1-B16A-00C0F0283628} 
         NumButtons      =   8
         BeginProperty Button1 {66833FEA-8583-11D1-B16A-00C0F0283628} 
            Caption         =   "Back"
            Key             =   "back"
            ImageIndex      =   1
         EndProperty
         BeginProperty Button2 {66833FEA-8583-11D1-B16A-00C0F0283628} 
            Caption         =   "Forward"
            Key             =   "forward"
            ImageIndex      =   2
         EndProperty
         BeginProperty Button3 {66833FEA-8583-11D1-B16A-00C0F0283628} 
            Caption         =   "Stop"
            Key             =   "stop"
            ImageIndex      =   3
         EndProperty
         BeginProperty Button4 {66833FEA-8583-11D1-B16A-00C0F0283628} 
            Caption         =   "Refresh"
            Key             =   "refresh"
            ImageIndex      =   4
         EndProperty
         BeginProperty Button5 {66833FEA-8583-11D1-B16A-00C0F0283628} 
            Caption         =   "Home"
            Key             =   "home"
            ImageIndex      =   5
         EndProperty
         BeginProperty Button6 {66833FEA-8583-11D1-B16A-00C0F0283628} 
            Caption         =   "Seach"
            Key             =   "seach"
            ImageIndex      =   6
         EndProperty
         BeginProperty Button7 {66833FEA-8583-11D1-B16A-00C0F0283628} 
            Caption         =   "Exit"
            Key             =   "exit"
            ImageIndex      =   7
         EndProperty
         BeginProperty Button8 {66833FEA-8583-11D1-B16A-00C0F0283628} 
            Caption         =   "Open"
            Key             =   "open"
            ImageIndex      =   8
         EndProperty
      EndProperty
      Begin VB.Label Label1 
         BackColor       =   &H8000000E&
         Caption         =   "Lajjsgk"
         ForeColor       =   &H000000FF&
         Height          =   2000
         Left            =   1080
         TabIndex        =   4
         Top             =   2000
         Width           =   1000
      End
   End
   Begin SHDocVwCtl.WebBrowser WebBrowser1 
      Height          =   2295
      Left            =   600
      TabIndex        =   0
      Top             =   1920
      Width           =   4335
      ExtentX         =   7646
      ExtentY         =   4048
      ViewMode        =   0
      Offline         =   0
      Silent          =   0
      RegisterAsBrowser=   0
      RegisterAsDropTarget=   1
      AutoArrange     =   0   'False
      NoClientEdge    =   0   'False
      AlignLeft       =   0   'False
      NoWebView       =   0   'False
      HideFileNames   =   0   'False
      SingleClick     =   0   'False
      SingleSelection =   0   'False
      NoFolders       =   0   'False
      Transparent     =   0   'False
      ViewID          =   "{0057D0E0-3573-11CF-AE69-08002B2E1262}"
      Location        =   "res://D:\WINNT\system32\shdoclc.dll/dnserror.htm#http:///"
   End
   Begin VB.Label Label2 
      Alignment       =   1  'Right Justify
      Caption         =   "Label1"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   10.5
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   495
      Left            =   0
      TabIndex        =   5
      Top             =   840
      Width           =   1215
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Public StartingAddress As String
Dim flag As Boolean
Private Sub Form_Load()
Label2.Left = 0
Label2.Top = Toolbar1.Height
Combo1.Top = Toolbar1.Height
Label2.Caption = "地址:  "
Label2.Height = 315
Combo1.Left = Label1.Width
Combo1.Width = Form1.Width - Label2.Width
WebBrowser1.Width = Form1.ScaleWidth
WebBrowser1.Top = Combo1.Top + 500
WebBrowser1.Height = Form1.ScaleHeight - Combo1.Height - StatusBar1.Height - 200
WebBrowser1.Left = 0


StatusBar1.Panels(1).Width = Form1.Width / 2
StatusBar1.Panels(2).Width = Form1.Width / 4
StatusBar1.Panels(3).Width = Form1.Width / 4
StatusBar1.Panels(2).Text = "我的电脑"
StatusBar1.Panels(3).Text = Str$(Time)
On Error Resume Next
Me.Show
Toolbar1.Refresh
Open App.Path & "\my.ini" For Input As #2
'打开上次的WEB地址
Input #2, StartingAddress
Close #2
If Len(StartingAddress) > 0 Then
Combo1.Text = StartingAddress
Combo1.AddItem StartingAddress
WebBrowser1.Navigate StartingAddress '打开Web
End If
End Sub

Private Sub Form_Resize()
Label2.Left = 0
Label2.Top = Toolbar1.Height
Combo1.Top = Toolbar1.Height
Label2.Caption = "地址:  "
Label2.Height = 315
Combo1.Left = Label1.Width
Combo1.Width = Form1.Width - Label2.Width
WebBrowser1.Width = Form1.ScaleWidth
WebBrowser1.Top = Combo1.Top + 500
WebBrowser1.Height = Form1.ScaleHeight - Combo1.Top - Combo1.Height - StatusBar1.Height - 200
WebBrowser1.Left = 0


StatusBar1.Panels(1).Width = Form1.Width / 2
StatusBar1.Panels(2).Width = Form1.Width / 4
StatusBar1.Panels(3).Width = Form1.Width / 4

End Sub


Private Sub webbrowser1_DownloadComplete()
 On Error Resume Next
 Me.Caption = WebBrowser1.LocationName '下载
End Sub
Private Sub webbrowser1_NavigateComplete(ByVal URL As String)
'下载完成
Dim i As Integer
Dim bFound As Boolean
Me.Caption = WebBrowser1.LocationName
For i = 0 To Combo1.ListCount - 1
If Combo1.List(i) = WebBrowser1.LocationURL Then
bFound = True
Exit For
End If
Next i
flag = True
If bFound Then
Combo1.RemoveItem i
End If
Combo1.AddItem WebBrowser1.LocationURL, 0
Combo1.ListIndex = 0
MousePointer = 0
WebBrowser1.Navigate Combo1.Text
StatusBar1.Panels(1).Text = "当前页面:" & Combo1.Text
flag = False
End Sub
Private Sub combo1_Click()
 If flag Then Exit Sub
    Timer1.Enabled = True
    MousePointer = 11
    StatusBar1.Panels(1).Text = ″正在连接″ + Combo1.Text + ".........."
    WebBrowser1.Navigate Combo1.Text
End Sub
Private Sub combo1_KeyPress(KeyAscii As Integer)
On Error Resume Next
 If KeyAscii = vbKeyReturn Then
   If flag Then Exit Sub
    Timer1.Enabled = True
    MousePointer = 11
    StatusBar1.Panels(1).Text = ″正在连接″ + Combo1.Text + ".........."
    WebBrowser1.Navigate Combo1.Text
 End If
End Sub
Private Sub Timer1_Timer()
  StatusBar1.Panels(3).Text = Str$(Time)
  If WebBrowser1.LocationURL <> "" Then
  If WebBrowser1.Busy = False Then
     Timer1.Enabled = False
     Me.Caption = WebBrowser1.LocationName
     StatusBar1.Panels(1).Text = "完成"
  Else
     Timer1.Enabled = True
     Combo1.Text = WebBrowser1.LocationURL
     Me.Caption = WebBrowser1.LocationName
     StatusBar1.Panels(1).Text = "正在下载: " + WebBrowser1.LocationURL + "......"
  End If
  End If
End Sub
Private Sub ToolBar1_ButtonClick(ByVal Button As Button)
On Error Resume Next
Timer1.Enabled = True
Select Case Button.Key
Case "exit"
Open App.Path & "\my.ini" For Output As #2
'保存的WEB地址
Write #2, Combo1.Text
Close #2
Unload Me
Case "back"
WebBrowser1.GoBack
Case "forward"
WebBrowser1.GoForward
Case "refresh"
WebBrowser1.Refresh
Case "home"
WebBrowser1.GoHome
Case "search"
WebBrowser1.GoSearch
Case "open"
On Error GoTo Handle
CommonDialog1.ShowOpen
Combo1.Text = CommonDialog1.FileName
WebBrowser1.Navigate CommonDialog1.FileName
Handle:
MsgBox "Can't Open :" + CommonDialog1.FileName, vbOKOnly
Case "stop"
Timer1.Enabled = False
MousePointer = 0
WebBrowser1.Stop
Me.Caption = WebBrowser1.LocationName
End Select
End Sub


⌨️ 快捷键说明

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