Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Parental Control in VB6

Status
Not open for further replies.

hackoo

Programmer
Jan 31, 2003
28
TN
Hello, i'm looking for a Parental Control software with its code source in VB6.

I found in the internet a freeware with its code source but it was make in delphi, which is entitled Logprotect It's really very well but my problem is I want that my Logfile to be send to my account FTP. and I cannot configure it only just by e-mail in Logprotect.This is for that reason that I want to make a small personal software of Parental Control with option sending of the Logfile towards my account FTP.
Please, if you can advise me that How to make exactly and which examples of API in VB6 to use in my Program? And how to use a list of words to censor "Bad Words"

I'm thinking in this solution :
My program "watches" the activity of the opening of internet page, I make it read the page and if one of the words on which I decided as being forbidden is contained in the page, I close the page.
So my question is how can i write this Function ?
Thank you for your reply !
 
I'm sure it's possible to read the contents of a webpage before they actually get displayed in the browser but it would require an extensive explanation here, apart from which if you wanted to just block webpages based on words then presumably you'd use the browser's own in-built parental controls? So because you posted this question on a VB forum here's a VB answer.

Use VB's WebBrowser control and wait for the DocumentComplete event to fire, then read the underlying HTML of the webpage to see if any of your blocked words exist, and only make the page visible if it passes.

To outline this solution:

In: WebBrowser1.BeforeNavigate do something like
Code:
WebBrowser1.Visible = False

In: WebBrowser1.DocumentComplete do something like
Code:
Dim BlockedWords() As String
HTML$ = WebBrowser1.Document.Body.innerHTML
BlockedWords = Split("klingon,kirk,spock,7 of 9", ",")
For A& = 0 To UBound(BlockedWords)
  If (Instr(1, HTML$, BlockedWords(A&), vbTextCompare) <> 0) Then Blocked = True: Exit For
Next A&
WebBrowser1.Visible = Not Blocked

You'd have to write a simple Browser-style interface with Back / Next buttons and an address bar but the WebBrowser control makes calling the relevant functions very straightforward. And no, before anyone asks, I would never block 7 of 9.

- Andy
___________________________________________________________________
If you think nobody cares you're alive, try missing a couple of mortgage payments
 
Andy,

I don't know if you know this, but the WB will not come to a READYSTATE_COMPLETE while it is invisible...
[tt]
Option Explicit

Private Sub Command1_Click()
WB.Visible = False
WB.Navigate "Do While WB.ReadyState <> READYSTATE_COMPLETE
DoEvents
Loop
WB.Visible = True
End Sub
[/tt]
It will only get as far as READYSTATE_INTERACTIVE (3) however if you do this....
[tt]
Option Explicit

Private Sub Command1_Click()
Dim L As Integer
L = WB.Left
WB.Left = Me.Width + 500
WB.Navigate "Do While WB.ReadyState <> READYSTATE_COMPLETE
DoEvents
Loop
WB.Left = L
End Sub
[/tt]
Then again it just may be my computer XP SP3, Studio 6 Ent SP5, Studio 2k8 Pro SP1, IE8.

Beyond that if OP wants to use IE there is the possibility of strongm's code in but that however will start to display the page prior to your program to being able to shut it down or redirecting it.

Good Luck
 
Good point, no I didn't realise the event doesn't fire if the control is invisible. Your solution is good, or you use a PictureBox to obscure the WebBrowser while the next page loads.

- Andy
___________________________________________________________________
If you think nobody cares you're alive, try missing a couple of mortgage payments
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top