browsctl.frm
Upload User: xhy777
Upload Date: 2007-02-14
Package Size: 24088k
Code Size: 7k
Category:

Windows Kernel

Development Platform:

Visual C++

  1. VERSION 4.00
  2. Begin VB.Form browsectl 
  3.    Caption         =   "Explorer in a form"
  4.    ClientHeight    =   5745
  5.    ClientLeft      =   4005
  6.    ClientTop       =   2580
  7.    ClientWidth     =   7920
  8.    Height          =   6150
  9.    Left            =   3945
  10.    LinkTopic       =   "Form2"
  11.    ScaleHeight     =   5745
  12.    ScaleWidth      =   7920
  13.    Top             =   2235
  14.    Width           =   8040
  15.    Begin VB.CommandButton Refresh 
  16.       Caption         =   "Refresh"
  17.       Height          =   375
  18.       Left            =   6720
  19.       TabIndex        =   8
  20.       Top             =   120
  21.       Width           =   735
  22.    End
  23.    Begin VB.CommandButton Stop 
  24.       Caption         =   "Stop"
  25.       Height          =   375
  26.       Left            =   6240
  27.       TabIndex        =   7
  28.       Top             =   120
  29.       Width           =   495
  30.    End
  31.    Begin VB.CommandButton Go 
  32.       Caption         =   "Go"
  33.       Height          =   375
  34.       Left            =   3600
  35.       TabIndex        =   6
  36.       Top             =   120
  37.       Width           =   495
  38.    End
  39.    Begin VB.CommandButton Search 
  40.       Caption         =   "Search"
  41.       Height          =   375
  42.       Left            =   5520
  43.       TabIndex        =   4
  44.       Top             =   120
  45.       Width           =   735
  46.    End
  47.    Begin VB.TextBox Location 
  48.       Height          =   375
  49.       Left            =   120
  50.       TabIndex        =   3
  51.       Top             =   120
  52.       Width           =   3375
  53.    End
  54.    Begin VB.CommandButton Home 
  55.       Caption         =   "Home"
  56.       Height          =   375
  57.       Left            =   4920
  58.       TabIndex        =   2
  59.       Top             =   120
  60.       Width           =   615
  61.    End
  62.    Begin VB.CommandButton Forward 
  63.       Caption         =   ">"
  64.       Enabled         =   0   'False
  65.       Height          =   375
  66.       Left            =   4560
  67.       TabIndex        =   1
  68.       Top             =   120
  69.       Width           =   375
  70.    End
  71.    Begin VB.CommandButton Back 
  72.       Caption         =   "<"
  73.       Enabled         =   0   'False
  74.       Height          =   375
  75.       Left            =   4200
  76.       TabIndex        =   0
  77.       Top             =   120
  78.       Width           =   375
  79.    End
  80.    Begin SHDocVwCtl.WebBrowser WebBrowser1 
  81.       Height          =   4455
  82.       Left            =   120
  83.       TabIndex        =   9
  84.       Top             =   600
  85.       Width           =   7575
  86.       Object.Height          =   297
  87.       Object.Width           =   505
  88.       AutoSize        =   0
  89.       ViewMode        =   1
  90.       AutoSizePercentage=   0
  91.       AutoArrange     =   -1  'True
  92.       NoClientEdge    =   -1  'True
  93.       AlignLeft       =   0   'False
  94.       Location        =   "file://C:WINDOWSSYSTEMBLANK.HTM"
  95.    End
  96.    Begin ComctlLib.StatusBar StatusBar 
  97.       Align           =   2  'Align Bottom
  98.       Height          =   495
  99.       Left            =   0
  100.       TabIndex        =   5
  101.       Top             =   5250
  102.       Width           =   7920
  103.       _Version        =   65536
  104.       _ExtentX        =   13970
  105.       _ExtentY        =   873
  106.       _StockProps     =   68
  107.       AlignSet        =   -1  'True
  108.       SimpleText      =   ""
  109.       i1              =   "browsctl.frx":0000
  110.    End
  111. End
  112. Attribute VB_Name = "browsectl"
  113. Attribute VB_Creatable = False
  114. Attribute VB_Exposed = False
  115. Private Sub ShellFolderOC1_Click()
  116. End Sub
  117. Private Sub Back_Click()
  118.     On Error GoTo Boom
  119.     
  120.     WebBrowser1.GoBack
  121.     GoTo endfunc
  122. Boom:
  123.     Beep
  124. endfunc:
  125.    
  126. End Sub
  127. Private Sub Form_Resize()
  128.    WebBrowser1.Width = Width - (WebBrowser1.Left * 2)
  129.    Rem I wish I new the internal height instead of whole height
  130.    WebBrowser1.Height = Height - StatusBar.Height - WebBrowser1.Top - (WebBrowser1.Top - (Location.Top + Location.Height)) - Location.Top - 2 * (WebBrowser1.Top - (Location.Top + Location.Height))
  131. End Sub
  132. Private Sub Forward_Click()
  133.     On Error GoTo Boom
  134.     WebBrowser1.GoForward
  135.     GoTo endfunc
  136. Boom:
  137.     Beep
  138. endfunc:
  139. End Sub
  140. Private Sub Go_Click()
  141.     On Error GoTo Error:
  142.     If KeyAscii = 13 Then
  143.         WebBrowser1.Navigate (Location)
  144.     End If
  145.     Exit Sub
  146.     
  147. Error:
  148.     StatusBar.Panels(1).Text = Err.Description + "(" + Hex(Err) + ")"
  149.     Beep
  150. End Sub
  151. Private Sub Home_Click()
  152.     On Error GoTo Boom
  153.     
  154.     WebBrowser1.GoHome
  155.     GoTo endfunc
  156. Boom:
  157.     Beep
  158. endfunc:
  159. End Sub
  160. Private Sub Location_KeyPress(KeyAscii As Integer)
  161.     On Error GoTo Error:
  162.     If KeyAscii = 13 Then
  163.         WebBrowser1.Navigate (Location)
  164.     End If
  165.     Exit Sub
  166.     
  167. Error:
  168.     StatusBar.Panels(1).Text = Err.Description + "(" + Hex(Err) + ")"
  169.     Beep
  170. End Sub
  171. Private Sub Refresh_Click()
  172.     On Error GoTo Boom
  173.     WebBrowser1.Refresh
  174.     GoTo endfunc
  175. Boom:
  176.     Beep
  177. endfunc:
  178. End Sub
  179. Private Sub Search_Click()
  180.     On Error GoTo Boom
  181.     WebBrowser1.GoSearch
  182.     GoTo endfunc
  183. Boom:
  184.     Beep
  185. endfunc:
  186. End Sub
  187. Private Sub StatusBar1_PanelClick(ByVal Panel As Panel)
  188. End Sub
  189. Private Sub ShellExplorer1_OnBeginNavigate(ByVal HLink As Object, Cancel As Boolean)
  190. End Sub
  191. Private Sub Stop_Click()
  192.     On Error GoTo Boom
  193.     WebBrowser1.Stop
  194.     GoTo endfunc
  195. Boom:
  196.     Beep
  197. endfunc:
  198. End Sub
  199. Private Sub WebBrowser1_OnBeginNavigate(ByVal URL As String, ByVal Flags As Long, ByVal TargetFrameName As String, PostData As Variant, ByVal Headers As String, ByVal Referrer As String, Cancel As Boolean)
  200.     On Error GoTo Boom:
  201.     StatusBar.Panels(1).Text = HLink.Location
  202.     GoTo Done
  203. Boom:
  204.     Beep
  205. Done:
  206. End Sub
  207. Private Sub WebBrowser1_OnCommandStateChange(ByVal Command As Long, ByVal Enable As Boolean)
  208.     Rem we need to define the commands some place
  209.     If Command = 2 Then
  210.         Back.Enabled = Enable
  211.     ElseIf Command = 1 Then
  212.         Forward.Enabled = Enable
  213.     End If
  214. End Sub
  215. Private Sub WebBrowser1_OnDownloadComplete()
  216. StatusBar.Panels(1).Text = "Page Complete"
  217. End Sub
  218. Private Sub WebBrowser1_OnNavigate(ByVal URL As String, ByVal Flags As Long, ByVal TargetFrameName As String, PostData As Variant, ByVal Headers As String, ByVal Referrer As String)
  219.     On Error GoTo Boom
  220.     Location = HLink.Location
  221.     GoTo endfunc
  222. Boom:
  223.     Beep
  224. endfunc:
  225. End Sub
  226. Private Sub WebBrowser1_OnStatusTextChange(ByVal bstrText As String)
  227.     StatusBar.Panels(1).Text = bstrText
  228. End Sub
  229. Private Sub WebBrowser1_BeforeNavigate(ByVal URL As String, ByVal Flags As Long, ByVal TargetFrameName As String, PostData As Variant, ByVal Headers As String, Cancel As Boolean)
  230.     StatusBar.Panels(1).Text = "Before Nav: " + URL
  231. End Sub
  232. Private Sub WebBrowser1_NavigateComplete(ByVal URL As String)
  233.     StatusBar.Panels(1).Text = "End Nav: " + URL
  234. End Sub
  235. Private Sub WebBrowser1_StatusTextChange(ByVal Text As String)
  236.     StatusBar.Panels(1).Text = Text
  237. End Sub