VB produced IE-- own browser Author: Money can Building
Do you do your browser? Have you made a mistake? Don't say like IE like IE, it is a small Opera, and most ordinary people don't do it. But if you have a VB5.0 professional version in your machine, then things will be better, do you want to try it? Well, the protagonist of the Let's Go! Program is an ActiveX control: WebBrowser. Of course, in the default state, there is nothing in the toolbox of VB. We have to manually join, the method is: Right-click the toolbox, select "Parts ..." in the shortcut menu, make sure to select in the pop-up dialog box "Control" tab, find Microsoft Internet Controls, hook in the small box in front, then determine. At this point, you will find that there are more than two small icons in the toolbox, of which the controls of the Earth icon are exactly the WebBrowser we need. Since many people are not very familiar with the WebBrowser control, VB's help has not been related to it (anyway I have not found), so it is necessary to introduce its properties, methods, and events, limited to space, we only involve it in the program. : Property: LocationURL Returns the control to the URL of the web page. Method: NaviGate Transfer to the specified URL or open the specified HTML file. Event: 1. Downloadbegin Downloads Time Time Time Time. 2. DownloadComplete downloads to trigger when done, terminate or fail. 3. The ProgressChange WebBrowser control tracks the process of downloading and triggers this event regularly. Its syntax is: SUB WebBrowser_ProgressChange (Byval ProgressMax as long). Progress variable yuan is the total amount of data that has been downloaded, and ProgressMax is the total amount of data to be downloaded. 4. Titlechange Current Document Title When the title is triggered except for WebBrowser controls, the program also needs a label control: Label1; a ComboBox control: Combo1, used to display the URL address; a StatusBar control: statusbar1; a progressbar control: Progressbar1, used to display the download progress (STATUSBAR controls and ProgressBar controls are members of the ActiveX Control Microsoft Windows Common Controls5.0, the method of adding the toolbox with the WebBrowser control, with the attribute value of these controls with default.
The following is a list of procedures: option expedition () me.caption = "My Explorer" label1.caption = "URL" combo1.text = "" Combo1.top = Label1.Height Combo1.Left = 0 webbrowser1.top = Combo1 .Top Combo1.Height WebBrowser1.Left = 0 Form_Resize StatusBar1.Style = sbrSimple ProgressBar1.Zorder End Sub Private Sub Form_Resize () On Error GoTo a Combo1.Width = Form1.Width - 100 WebBrowser1.Width = Combo1.Width WebBrowser1.Height = Form1.Height - Combo1.Height - 1000 ProgressBar1.Top = Me.Height - StatusBar1.Height - 330 ProgressBar1.Left = 0.25 * StatusBar1.Width ProgressBar1.Width = 0.75 * Me.Width - 250 a: End Sub Private Sub Combo1_Click () `to specify a URL WebBrowser1.Navigate Combo1.Text End Sub Private Sub Combo1_KeyDown (KeyCode As Integer, Shift As Integer) Dim I As Long Dim existed As Boolean If KeyCode = 13 Then If Left (Combo1.Text, 7) < > "Http: //" Then Combo1.text = "http: //" combo1.text end if Webbrowser1.naVigate Combo1.Text for i = 0 to Combo1.ListCoun t - 1 If Combo1.List (I) = Combo1.Text Then existed = True Exit For Else existed = False End If Next If Not existed Then Combo1.AddItem (Combo1.Text) End If End If End Sub Private Sub WebBrowser1_DownloadBegin () `Download start time status bar display" now lineing ... "statusbar1.simpletext =" now linking ... "End Sub Private Sub webbrowser1_downloadcomplete ()` Download completion status bar display "Link Finished" statusbar1.simpletext = "Link Finished "ProgressBar1.Value = 0 End Sub Private Sub Webbrowser1_ProgressChange (Byval ProgressMax as long)`