|
-
Jun 11th, 2006, 05:44 AM
#1
Thread Starter
Frenzied Member
[RESOLVED] strange problem with webbrowser control
i am trying to connect to the google accounts page using a webbrowser control .the zipped file has the project which connects to the login page .
now if i click the step1 button it shows as disconnected but if i click secondmethod 1 button followed by secondmethod 2 button it shows as connected though both are executing the same set of statements..
i also tried the following to wait for the webbrowser to complete loading
VB Code:
Do While webbrowser1.busy
DoEvents
sleep(1000)
Loop
any ideas why it does so??
Last edited by litlewiki; Apr 13th, 2007 at 02:02 PM.
-
Jun 11th, 2006, 08:41 AM
#2
Thread Starter
Frenzied Member
Re: strange problem with webbrowser control
here's the code
VB Code:
'for method one
Private Sub Command1_Click()
WebBrowser1.Navigate2 "https://www.google.com/accounts/ServiceLoginBox?continue=https%3A%2F%2Fwww.orkut.com%2FRedirLogin.aspx%3Fmsg%3D0%26page%3Dhttp%253A%252F%252Fwww.orkut.com%252F&followup=https%3A%2F%2Fwww.orkut.com%2FGLogin.aspx&service=orkut&nui=2&uilel=1&skipvpage=true&hl=en-US"
Do While blnBusy
'DoEvents
Sleep (10000)
Loop
WebBrowser1.Navigate2 "http://www.google.com/accounts/Logout?continue=https%3A%2F%2Fwww.google.com%2Faccounts%2FServiceLoginBox%3Fcontinue%3Dhttps%253A%252F%252Fwww.orkut.com%252FRedirLogin.aspx%253Fmsg%253D0%2526page%253Dhttp%25253A%25252F%25252Fwww.orkut.com%25252F%26followup%3Dhttps%253A%252F%252Fwww.orkut.com%252FGLogin.aspx%26service%3Dorkut%26nui%3D2%26uilel%3D1%26skipvpage%3Dtrue%26hl%3Den-US&il=true&zx=11ni6cru3aqhf"
Do While blnBusy
'DoEvents
Sleep (10000)
Loop
If (InStr(urlstring, "http://www.google.com/accounts") > 0) Or (InStr(urlstring2, "https://www.google.com/accounts") > 0) Then
MsgBox "Connected"
Else
MsgBox "Disconnected"
End If
end sub
VB Code:
'for step one of second method
Private Sub Command3_Click()
WebBrowser1.Navigate2 "https://www.google.com/accounts/ServiceLoginBox?continue=https%3A%2F%2Fwww.orkut.com%2FRedirLogin.aspx%3Fmsg%3D0%26page%3Dhttp%253A%252F%252Fwww.orkut.com%252F&followup=https%3A%2F%2Fwww.orkut.com%2FGLogin.aspx&service=orkut&nui=2&uilel=1&skipvpage=true&hl=en-US"
Do While WebBrowser1.Busy
DoEvents
Sleep (500)
Loop
WebBrowser1.Navigate2 "http://www.google.com/accounts/Logout?continue=https%3A%2F%2Fwww.google.com%2Faccounts%2FServiceLoginBox%3Fcontinue%3Dhttps%253A%252F%252Fwww.orkut.com%252FRedirLogin.aspx%253Fmsg%253D0%2526page%253Dhttp%25253A%25252F%25252Fwww.orkut.com%25252F%26followup%3Dhttps%253A%252F%252Fwww.orkut.com%252FGLogin.aspx%26service%3Dorkut%26nui%3D2%26uilel%3D1%26skipvpage%3Dtrue%26hl%3Den-US&il=true&zx=11ni6cru3aqhf"
Do While WebBrowser1.Busy
DoEvents
Sleep (500)
Loop
End Sub
VB Code:
'step 2 of second method
Private Sub Command2_Click()
If (InStr(urlstring, "http://www.google.com/accounts") > 0) Or (InStr(urlstring2, "https://www.google.com/accounts") > 0) Then
MsgBox "Connected"
Else
MsgBox "Disconnected"
End If
end sub
the problem could be that it is taking time for the webbrowser to obtain the url from google's side.i am thinking of using timers to control the fire the events but that would be really silly
-
Jun 11th, 2006, 08:45 AM
#3
Re: strange problem with webbrowser control
Check the URLs. Looks like they are invalid.
-
Jun 11th, 2006, 08:49 AM
#4
Thread Starter
Frenzied Member
Re: strange problem with webbrowser control
there are just 2 urls
the first one
https://www.google.com/accounts/Serv...=true&hl=en-US
the second one
http://www.google.com/accounts/Logou...=11ni6cru3aqhf
in the instr iam only matching the stored urls in the urlstring variable with the partial url
-
Jun 11th, 2006, 08:52 AM
#5
PowerPoster
Re: strange problem with webbrowser control
I'm just putting in my pennyworth here, but sites like google, yahoo, MSN et al usually have dynamic data in their POST strings and also some use POST while others use GET...both of these issues make it harder to directly access certain features.
Again, I am suggesting you use HTTP Interceptor (I suggested same to someone else recently :-)) which will let you see what is sent to google and under "data found after header end" will be any GET data...if there's any GET data you can't just put it as part of the URL in webbrowser, you have to define it in the headers when you request the data...it's something I've done in the past, but I'm sorry I can't personally help you with it as I'm not 100% sure about how to do it. I'm sure someone else will help if need be :-)
This isn't related directly to your issue stated above, but it might become an issue as you're working with either POST or GET in webbrowser and as I said most of those "login" sites use GET :-)
Edit: Forgot to say you also need to buid POST/GET data from the form data in the HTML, possibly. I'm sure you know what you're doing in that case though :-)
Last edited by smUX; Jun 11th, 2006 at 08:56 AM.
Well, everyone else has been doing it :-)
Loading a file into memory QUICKLY - Using SendKeys - HyperLabel - A highly customisable label replacement - Using resource files/DLLs with VB - Adding GZip to your projects
Expect more to come in future
If I have helped you, RATE ME! :-)
I love helping noobs with their VB problems (probably because, as an amateur programmer, I am only slightly better at VB than them :-)) but if you SERIOUSLY want to get help for free from a community such as VBForums, you have to first have a grounding (basic knowledge) in VB6, otherwise you're way too much work to help...You've got to give a little if you want to get help from us, in other words!
And we DON'T do your homework. If your tutor doesn't teach you enough to help you make the project without his or her help, FIND A BETTER TUTOR or try reading books on programming! We are happy to help with minor things regarding the project, but you have to understand the rest of it if you want our help to be useful.
-
Jun 11th, 2006, 09:00 AM
#6
Thread Starter
Frenzied Member
Re: strange problem with webbrowser control
i understand that point but iam not really into deep google programming.as i explained above clicking first button returns a not connected message (though it actually is).whereas clicking the second button and then third button retuns a connected message(second buttons code + third buttons code = first buttons code)...i donno why this is happening
also i found out that if i use two timers and then use each one of them to fire the two events, it works(with a gap of 4-5 seconds).but that would be too lame dont u think??
-
Jun 12th, 2006, 05:58 AM
#7
Thread Starter
Frenzied Member
Re: strange problem with webbrowser control
-
Jun 12th, 2006, 08:39 AM
#8
PowerPoster
Re: strange problem with webbrowser control
I have no idea related directly to your problem. However, I still don't understand what this "connected" and "disconnected" means if you're using webbrowser...webbrowser handles the connections itself, downloads the pages then displays them...there is no "connected" :-P
Well, everyone else has been doing it :-)
Loading a file into memory QUICKLY - Using SendKeys - HyperLabel - A highly customisable label replacement - Using resource files/DLLs with VB - Adding GZip to your projects
Expect more to come in future
If I have helped you, RATE ME! :-)
I love helping noobs with their VB problems (probably because, as an amateur programmer, I am only slightly better at VB than them :-)) but if you SERIOUSLY want to get help for free from a community such as VBForums, you have to first have a grounding (basic knowledge) in VB6, otherwise you're way too much work to help...You've got to give a little if you want to get help from us, in other words!
And we DON'T do your homework. If your tutor doesn't teach you enough to help you make the project without his or her help, FIND A BETTER TUTOR or try reading books on programming! We are happy to help with minor things regarding the project, but you have to understand the rest of it if you want our help to be useful.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|