Vb 6.0

Joined
Feb 13, 2006
Messages
9
Reaction score
0
Hey folks,
firstoff, I got a bad english so excuse me.

This is the Story, its necessary so you can understand in what kind of mess im sitting.
I made a hack for a game (It isnt important at all which one) and im using the "Microsoft internet Controls" sounds like a stupid solved Idea, well the site im using for it is ssl secruered and I really dont have that much of wisdom in vb yet to handle that so Im just using the controls. Everything works fine, the problem is for 80% of the people it doesent works good at all because im using instead of checkups if the site is ready to process the sendkeys of mine (to fill out and click on the forms) a msgbox as break and people need to wait inorder to make it work correctly, about 15 seconds... I'll try to make it shorter;

My Tool (internet controls)-->Accessing a hidden Browser object in the tool to navigate-->
Im using sendkeys to fill out the forms etc --> The user needs to count by himself the seconds
because there isnt like a IF command to check if the site done with loading or not.


My favour:

Can someone make for me an full example page with having a Browser Object in the tool,
which navigates through some stupid sites and fill out the forms when the page is done loading instead of doing it instant or with a msgbox. I also would appreciate if someone could show me a live example in the example (XD) How I can use a Percent Bar so I know how long each step takes (or the whole one)


And just I wont show up as a bad user;
I really tried lots of things, but most only works for the internet explorer as shell
and not as embeded object.

Thank you very very very much.


Edit: Im sorry but in all that rush I forgot to gave the thread a more specified name ^^
 
Last edited:
Here you go.

I'm sure you know how to navigate to the page itself.. but heres the code that fills out a form - view the html of the page to get the forms name as well as the names for the textboxs.

Code:
'form1 = the forms actual name
'username = the textboxs name
'they are case sensitive so remember not to mess that up
    With WebBrowser1.Document
        .All("username").Value = "Test"
        .Forms("form1").Submit 
    End With

If you want it to fill out the forum when the page is done loading try this event:
Code:
Private Sub WebBrowser1_DocumentComplete(ByVal pDisp As Object, URL As Variant)

End Sub

I used wait timer but this might work i'm not sure.

If you have any other questions don't hesitate to ask.
 
It marks the sub you've wrote.

Maybe Im supposed to include some kind of module etc?
If anyone would be such kind to upload a whole project which shows switching to
2 sites with the **.Documentcomplete ?
 
Last edited:
Works fine for me, it seems to activate twice or more thought depending on the page.. so I would have a 2 second timer and maybe have it set to true.

Put microsoft internet controls and drag it onto your form you should now have by default webbrowser1.

place a command button on the form as well and all this code should work.

Code:
Private Sub Command1_Click()
WebBrowser1.Navigate "www.yahoo.com"
End Sub

Private Sub WebBrowser1_DocumentComplete(ByVal pDisp As Object, URL As Variant)
MsgBox "its done"
End Sub
 
Interresting this works, but do you know a solution for an IF command for that? (So I can run a specified event after each documentcomplete) I cant seem to think off one.
Like If WebBrowser1_DocumentComplete("www yahoo .com") then
msgbox "done"
end if

like that or so.
 
This seems to work.. remember it will only match up against the exact url which would display in your internet browser for example if you do.. webbrowser1.navigate "www.yahoo.com" in the browser it would show as http://www.yahoo.com/ so thats what you check it against.

Code:
If URL = "http://www.yahoo.com/" Then
MsgBox "Document complete"
End If
 
Ohhhh thank you very much seems I didnt saw that url variable in the header :D
This really helped me alot! I just got a very last problem ... Because the last 2 pages has the same URL. Im now thinking of using a html parsing function but im not really sure and at all the site is using ssl which makes winsock probably as not a good choice.

InStr?
 
Last edited:
I'll tell you how I would do it.. to identify the pages I would look at their html line by line and find something that can distinguish each other part.. then use this code to the sources line by line and put them into an array.

Code:
Private Sub Command1_Click()
WebBrowser1.Navigate "www.google.com"
End Sub

Private Sub WebBrowser1_DocumentComplete(ByVal pDisp As Object, URL As Variant)
Dim Hsource() As String
Dim htmlSource As String

htmlSource = WebBrowser1.Document.body.innerhtml

Hsource = Split(htmlSource, vbNewLine)

'simple test with a listbox to see if it worked
For i = 0 To UBound(Hsource)
List1.AddItem Hsource(i)
Next
End Sub

Now I'm not going to bother writing parse code up because I don't know what you want to parse so why don't you do what I said and choose a line and all that.
 
Back