1. Introduction
As we all know, Visual Basic 5.0 (VB5.0) provides complete tools and mechanisms required to implement advanced Windows programs, and its powerful functions have been recognized by the majority of software developers; Explorer plays another important role in the rapid development of today's Internet. Its indelible effect, its ability to process HTML impresses every user. If VB5.0 and Explorer are combined, this will not only be the icing on the cake, but even more powerful. Theoretically, VB5.0 provides various aspects of expertise for the Internet, and Explorer can use VBScript to extend its functions. However, in actual implementation, programmers will encounter problems of one kind or another. Now we give An example that has been successfully debugged. Following this method, users can call Explore anywhere in their VB5.0 program to facilitate the use of "help files" or "hyperlinks".
2. Implementation method
First select "Project/Components" on the VB5.0 menu, then select the two controls MicrosoftInternetcontrols and MicrosoftcommonDialogControl5.0 to add the WebBrowser and Commodialog icons to the toolbar, and then Finally, on the Form1 form, as shown in Figure 1, introduce two Labels, one Text, three Commands, and one CommoDialog. The Captions of the three Commands are "Browse", "Open HTM" and "Cancel", which are used for writing. It is convenient to name the Commodialog as cd.
In the program, an Internet Explorer type target ii is generated. By calling the method ii.Navigatetext1, navNoreadfromcache, the HTML file name is given by text1.text, that is, the URL is given through Text1. In this way, the user can not only use VB5 .0 program can open the Explorer window freely, and the URL and window appearance are also determined by VB5.0. To make it clearer, remove the StandardButtons, AddressBar, Links, and TextLabels in Explorer's View/options/general.
Among them, the URL can be entered directly or selected through browsing.
3. Procedure
Dimii
PRivateSubCommand1_Click()
Cd.Flags=&H200
Cd.Filter="HTMLfiles(*.htm)|*.htm|TextFiles"&_
"(*.txt)|*.txt|AllFiles(*.*)|*.*"
Cd.ShowOpen
Text1=Cd.filename
Command2.Visible=True
EndSub
PrivateSubCommand2_Click()
Setii=GetObject("","INTERNETEXPLORER.application")
ii.NavigateText1,navNoReadFromCache
ii.Visible=1
ii.Top=0
ii.Left=0
ii.Width=Form1.Width
ii.Height=Screen.Height
EndSub
PrivateSubCommand3_Click()
Text1=""
UnloadMe
EndSub
PrivateSubForm_Load()
Form1.Top=Screen.Height/4
Form1.Left=0
Form1.Width=Screen.Width
Form1.Height=Screen.Height/2
Form1.BackColor=QBColor(2)
Label1.BackStyle=0
Label1.FontName="Heold"
Label1.FontSize=14
Label1.ForeColor=QBColor(7)
Label2.BackStyle=0
Label2.Caption="HTML"
Label2.FontName="brushscript"
Label2.FontSize=24
Command2.Visible=False
EndSub
PrivateSubText1_KeyPress(KeyAsciiAsInteger)
IfKeyAscii=13Then
Setii=GetObject("","INTERNETEXPLORER.APPLICATION")
ii.NavigateText1,navNoReadFromCache
ii.Visible=1
ii.Top=0
ii.Left=0
ii.Width=Form1.Width
ii.Height=Screen.Height
EndIf
EndSub->