Link to home
Start Free TrialLog in
Avatar of stnic
stnic

asked on

dumb question

I know there is a way to run a vb app while IE is running and manipulate which web sites can be viewed. I was wondering if a vb app could also not allow hyper links ?
You know, like you are allowed to go to certain web sites but if you try and link to another site which is not on the list by clicking on a hyper link, then you won't be allowed to do that.

If this can be done how?

Thanks for any feedback, my friend is working on a program that blocks internet sites from a listbox, what he found was that once at the approved web site they could click on a hyper link and leave the site.

I am using VB 5.0

stnic
Avatar of inthedark
inthedark
Flag of United Kingdom of Great Britain and Northern Ireland image

You may be able to do this by allowing access to the Internet by using VB's WebBrowser control.

With this control you can intercept a mouse click and determin which site has been requested. You can validate the UTL and if the site is in your approved list, allow the action to go ahead, or cancel the operation with a message "This site is not permitted!".

If you want to go this way I can post some code examples.....
VB's WbeBrowser control uses Internet Explorer as a code base. If will do all the IE does so all you have to do is create some buttons and address bars on the top of the screen.

Here is an example you can can download:
http://www.freevbcode.com/ShowCode.Asp?ID=379

There are many other Browser control examples on the internet.

PS on this versionit has a reference to Outlook 98.  If you don't have this loaded on your PC, select Project references and remove the Outlook 98 link.

In the form declarations comment out the following:

'Dim oloAPP As Outlook.Application
'Dim oloNS As Outlook.NameSpace
'Dim oloFolder As Outlook.MAPIFolder
'Dim oloNewMail As Outlook.MailItem
'Dim oloAddrList As Outlook.AddressList
'Dim oloAddrEntry As Outlook.AddressEntry
'Dim oloSharedFolder As Outlook.MAPIFolder
'Dim oloRecipient As Outlook.Recipient

Then Hit Run with full compile and comment out any statement which does not compile.


So now you just need to know how to stop access so some sites.

Private Sub WB_BeforeNavigate2(ByVal pDisp As Object, URL As Variant, flags As Variant, TargetFrameName As Variant, PostData As Variant, headers As Variant, Cancel As Boolean)
If Not CheckURLApproved(URL) Then
    Cancel = True
End If
End Sub

So you write a function CheckURLApproved to validate the URL.
Avatar of stnic
stnic

ASKER

hi inthedark / Thanks for the comment and download site! If you want to work me up some working code with instructions I can bump up the points. I am drained at the moment from code overload. Still a novice and get confused real easily. Would really love to just run some code and see how it works rather than than the brain drain since my brain went to sleep three hours ago:)

Thanks

stnic
ASKER CERTIFIED SOLUTION
Avatar of Richie_Simonetti
Richie_Simonetti
Flag of Argentina image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of stnic

ASKER

Hey Thanks for the code link! Worked like a charm!

stnic
Thanks for "A" grade.