home *** CD-ROM | disk | FTP | other *** search
/ distrib.akp.su/Programming/Vb-6+Rus/ / distrib.akp.su.tar / distrib.akp.su / Programming / Vb-6+Rus / VB98 / TEMPLATE / FORMS / BROWSER.FRM < prev    next >
Text File  |  1998-06-27  |  8KB  |  260 lines

  1. VERSION 5.00
  2. Object = "{831FDD16-0C5C-11d2-A9FC-0000F8754DA1}#2.0#0"; "mscomctl.ocx"
  3. Object = "{EAB22AC0-30C1-11CF-A7EB-0000C05BAE0B}#1.1#0"; "shdocvw.dll"
  4. Begin VB.Form frmBrowser 
  5.    ClientHeight    =   5130
  6.    ClientLeft      =   3060
  7.    ClientTop       =   3345
  8.    ClientWidth     =   6540
  9.    LinkTopic       =   "Form1"
  10.    MDIChild        =   -1  'True
  11.    ScaleHeight     =   5130
  12.    ScaleWidth      =   6540
  13.    ShowInTaskbar   =   0   'False
  14.    Begin MSComctlLib.Toolbar tbToolBar 
  15.       Align           =   1  'Align Top
  16.       Height          =   540
  17.       Left            =   0
  18.       TabIndex        =   3
  19.       Top             =   0
  20.       Width           =   6540
  21.       _ExtentX        =   11536
  22.       _ExtentY        =   953
  23.       ButtonWidth     =   820
  24.       ButtonHeight    =   794
  25.       Appearance      =   1
  26.       ImageList       =   "imlIcons"
  27.       _Version        =   393216
  28.       BeginProperty Buttons {66833FE8-8583-11D1-B16A-00C0F0283628} 
  29.          NumButtons      =   6
  30.          BeginProperty Button1 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  31.             Key             =   "Back"
  32.             Object.ToolTipText     =   "Back"
  33.             ImageIndex      =   1
  34.          EndProperty
  35.          BeginProperty Button2 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  36.             Key             =   "Forward"
  37.             Object.ToolTipText     =   "Forward"
  38.             ImageIndex      =   2
  39.          EndProperty
  40.          BeginProperty Button3 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  41.             Key             =   "Stop"
  42.             Object.ToolTipText     =   "Stop"
  43.             ImageIndex      =   3
  44.          EndProperty
  45.          BeginProperty Button4 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  46.             Key             =   "Refresh"
  47.             Object.ToolTipText     =   "Refresh"
  48.             ImageIndex      =   4
  49.          EndProperty
  50.          BeginProperty Button5 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  51.             Key             =   "Home"
  52.             Object.ToolTipText     =   "Home"
  53.             ImageIndex      =   5
  54.          EndProperty
  55.          BeginProperty Button6 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  56.             Key             =   "Search"
  57.             Object.ToolTipText     =   "Search"
  58.             ImageIndex      =   6
  59.          EndProperty
  60.       EndProperty
  61.    End
  62.    Begin SHDocVwCtl.WebBrowser brwWebBrowser 
  63.       Height          =   3734
  64.       Left            =   50
  65.       TabIndex        =   0
  66.       Top             =   1215
  67.       Width           =   5393
  68.       ExtentX         =   9525
  69.       ExtentY         =   6588
  70.       ViewMode        =   1
  71.       Offline         =   0
  72.       Silent          =   0
  73.       RegisterAsBrowser=   0
  74.       RegisterAsDropTarget=   0
  75.       AutoArrange     =   -1  'True
  76.       NoClientEdge    =   -1  'True
  77.       AlignLeft       =   0   'False
  78.       ViewID          =   "{0057D0E0-3573-11CF-AE69-08002B2E1262}"
  79.       Location        =   ""
  80.    End
  81.    Begin VB.Timer timTimer 
  82.       Enabled         =   0   'False
  83.       Interval        =   5
  84.       Left            =   6180
  85.       Top             =   1500
  86.    End
  87.    Begin VB.PictureBox picAddress 
  88.       Align           =   1  'Align Top
  89.       BorderStyle     =   0  'None
  90.       Height          =   675
  91.       Left            =   0
  92.       ScaleHeight     =   675
  93.       ScaleWidth      =   6540
  94.       TabIndex        =   4
  95.       TabStop         =   0   'False
  96.       Top             =   540
  97.       Width           =   6540
  98.       Begin VB.ComboBox cboAddress 
  99.          Height          =   315
  100.          Left            =   45
  101.          TabIndex        =   2
  102.          Text            =   "»»END!"
  103.          Top             =   300
  104.          Width           =   3795
  105.       End
  106.       Begin VB.Label lblAddress 
  107.          Caption         =   "&Address:"
  108.          Height          =   255
  109.          Left            =   45
  110.          TabIndex        =   1
  111.          Tag             =   "&Address:"
  112.          Top             =   60
  113.          Width           =   3075
  114.       End
  115.    End
  116.    Begin MSComctlLib.ImageList imlIcons 
  117.       Left            =   2670
  118.       Top             =   2325
  119.       _ExtentX        =   1005
  120.       _ExtentY        =   1005
  121.       BackColor       =   -2147483643
  122.       ImageWidth      =   24
  123.       ImageHeight     =   24
  124.       MaskColor       =   12632256
  125.       _Version        =   393216
  126.       BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628} 
  127.          NumListImages   =   6
  128.          BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  129.             Picture         =   "Web Browser.frx":0000
  130.             Key             =   ""
  131.          EndProperty
  132.          BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  133.             Picture         =   "Web Browser.frx":02E2
  134.             Key             =   ""
  135.          EndProperty
  136.          BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  137.             Picture         =   "Web Browser.frx":05C4
  138.             Key             =   ""
  139.          EndProperty
  140.          BeginProperty ListImage4 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  141.             Picture         =   "Web Browser.frx":08A6
  142.             Key             =   ""
  143.          EndProperty
  144.          BeginProperty ListImage5 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  145.             Picture         =   "Web Browser.frx":0B88
  146.             Key             =   ""
  147.          EndProperty
  148.          BeginProperty ListImage6 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  149.             Picture         =   "Web Browser.frx":0E6A
  150.             Key             =   ""
  151.          EndProperty
  152.       EndProperty
  153.    End
  154. End
  155. Attribute VB_Name = "frmBrowser"
  156. Attribute VB_GlobalNameSpace = False
  157. Attribute VB_Creatable = False
  158. Attribute VB_PredeclaredId = True
  159. Attribute VB_Exposed = False
  160. Option Explicit
  161.  
  162. Public StartingAddress As String
  163. Dim mbDontNavigateNow As Boolean
  164. Private Sub Form_Load()
  165.     On Error Resume Next
  166.     Me.Show
  167.     tbToolBar.Refresh
  168.     Form_Resize
  169.  
  170.     cboAddress.Move 50, lblAddress.Top + lblAddress.Height + 15
  171.  
  172.     If Len(StartingAddress) > 0 Then
  173.         cboAddress.Text = StartingAddress
  174.         cboAddress.AddItem cboAddress.Text
  175.         'try to navigate to the starting address
  176.         timTimer.Enabled = True
  177.         brwWebBrowser.Navigate StartingAddress
  178.     End If
  179.  
  180. End Sub
  181.  
  182.  
  183.  
  184. Private Sub brwWebBrowser_DownloadComplete()
  185.     On Error Resume Next
  186.     Me.Caption = brwWebBrowser.LocationName
  187. End Sub
  188.  
  189. Private Sub brwWebBrowser_NavigateComplete(ByVal URL As String)
  190.     Dim i As Integer
  191.     Dim bFound As Boolean
  192.     Me.Caption = brwWebBrowser.LocationName
  193.     For i = 0 To cboAddress.ListCount - 1
  194.         If cboAddress.List(i) = brwWebBrowser.LocationURL Then
  195.             bFound = True
  196.             Exit For
  197.         End If
  198.     Next i
  199.     mbDontNavigateNow = True
  200.     If bFound Then
  201.         cboAddress.RemoveItem i
  202.     End If
  203.     cboAddress.AddItem brwWebBrowser.LocationURL, 0
  204.     cboAddress.ListIndex = 0
  205.     mbDontNavigateNow = False
  206. End Sub
  207.  
  208. Private Sub cboAddress_Click()
  209.     If mbDontNavigateNow Then Exit Sub
  210.     timTimer.Enabled = True
  211.     brwWebBrowser.Navigate cboAddress.Text
  212. End Sub
  213.  
  214. Private Sub cboAddress_KeyPress(KeyAscii As Integer)
  215.     On Error Resume Next
  216.     If KeyAscii = vbKeyReturn Then
  217.         cboAddress_Click
  218.     End If
  219. End Sub
  220.  
  221. Private Sub Form_Resize()
  222.     cboAddress.Width = Me.ScaleWidth - 100
  223.     brwWebBrowser.Width = Me.ScaleWidth - 100
  224.     brwWebBrowser.Height = Me.ScaleHeight - (picAddress.Top + picAddress.Height) - 100
  225. End Sub
  226.  
  227. Private Sub timTimer_Timer()
  228.     If brwWebBrowser.Busy = False Then
  229.         timTimer.Enabled = False
  230.         Me.Caption = brwWebBrowser.LocationName
  231.     Else
  232.         Me.Caption = "Working..."
  233.     End If
  234. End Sub
  235.  
  236. Private Sub tbToolBar_ButtonClick(ByVal Button As Button)
  237.     On Error Resume Next
  238.      
  239.     timTimer.Enabled = True
  240.      
  241.     Select Case Button.Key
  242.         Case "Back"
  243.             brwWebBrowser.GoBack
  244.         Case "Forward"
  245.             brwWebBrowser.GoForward
  246.         Case "Refresh"
  247.             brwWebBrowser.Refresh
  248.         Case "Home"
  249.             brwWebBrowser.GoHome
  250.         Case "Search"
  251.             brwWebBrowser.GoSearch
  252.         Case "Stop"
  253.             timTimer.Enabled = False
  254.             brwWebBrowser.Stop
  255.             Me.Caption = brwWebBrowser.LocationName
  256.     End Select
  257.  
  258. End Sub
  259.  
  260.