Tangling The Web
Everything is "web-integrated" these days. Browsers (of course), desktops, MP3 players, word processors, why, even my toaster's web ready it actually chats to me via ToastMessenger!
There it goes againNo, Toasty, I don't want any toast right now tsk, see what I mean? Anyway, what I mean is, sometimes it is nice to see a web page in your setups, right?
NOTE: This means that your user MUST have Internet Explorer 4.01 or later, otherwise its crash time!
Press Ctrl+T and in the components dialog, add the Microsoft Internet Controls . Let's suppose you have a purpose for showing a web page (its nice to have a purpose) say, you want your user to read the latest FAQ or readme information. That latest info is stored at http://www.website.com/myfiles/faq.htm - so remember it when we need to write this URL J
Open the readme form (What? You didn't make one? Go to Part 1). Now, in the form, remove the text box and stuff and create a web browser object from the new components we added. Rename it to wb1 (the default, webbrowser1, is a loooong name). In the readme form's Form_Load () event, type in the following code:
Wb1.Navigate2 "http://www.website.com/myfiles/faq.htm"
Just in case your user doesn't have a net connection or is not connected at the time, that dreary PAGE NOT FOUND error will come up. To prevent it, change the above code in Form_Load () to the following. Also, bootstrap your HTML file (readme/faq) to the Windows directory, see part 2/part 3.
Dim iGo As StringIGo = MsgBox("Would you like to get the latest readme information and " & _"FAQs from the internet (Net Connection required). If so, connect to " & _"the net and click Yes, otherwise click No to read the current " & _"information within the setup.", _vbQuestion + vbYesNo, "Get Latest Info")' Let's see what the idiot (user) says...If iGo = vbYes Then Wb1.Navigate2 "http://www.website.com/myfiles/faq.htm"Else Wb1.navigate2 WindowsDir & "myfaq.htm"End If
There, a little bit of web savvy in your setup!
Author's Personal Note: Hi, erm, if you have a net connection please e-mail the police! The Developer.com Technocrats have enslaved me and are making me write articles!! Thanks! I gotta go, I hear General Moore approaching!!
Page 3 of 7
This article was originally published on November 20, 2002