Results 1 to 8 of 8

Thread: [RESOLVED] strange problem with webbrowser control

  1. #1

    Thread Starter
    Frenzied Member litlewiki's Avatar
    Join Date
    Dec 2005
    Location
    Zeta Reticuli Distro:Ubuntu Fiesty
    Posts
    1,162

    Resolved [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:
    1. Do While webbrowser1.busy
    2.     DoEvents
    3.     sleep(1000)
    4. Loop

    any ideas why it does so??
    Last edited by litlewiki; Apr 13th, 2007 at 02:02 PM.

  2. #2

    Thread Starter
    Frenzied Member litlewiki's Avatar
    Join Date
    Dec 2005
    Location
    Zeta Reticuli Distro:Ubuntu Fiesty
    Posts
    1,162

    Unhappy Re: strange problem with webbrowser control

    here's the code
    VB Code:
    1. 'for method one
    2. Private Sub Command1_Click()
    3. 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"
    4. Do While blnBusy
    5.     'DoEvents
    6.     Sleep (10000)
    7. Loop
    8.  
    9.  
    10. 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"
    11.  
    12. Do While blnBusy
    13.     'DoEvents
    14.     Sleep (10000)
    15. Loop
    16. If (InStr(urlstring, "http://www.google.com/accounts") > 0) Or (InStr(urlstring2, "https://www.google.com/accounts") > 0) Then
    17. MsgBox "Connected"
    18. Else
    19. MsgBox "Disconnected"
    20. End If
    21.  
    22. end sub

    VB Code:
    1. 'for step one of second method
    2. Private Sub Command3_Click()
    3. 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"
    4. Do While WebBrowser1.Busy
    5.     DoEvents
    6.     Sleep (500)
    7. Loop
    8.  
    9. 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"
    10.  
    11. Do While WebBrowser1.Busy
    12.     DoEvents
    13.     Sleep (500)
    14. Loop
    15.  
    16. End Sub

    VB Code:
    1. 'step 2 of second method
    2. Private Sub Command2_Click()
    3. If (InStr(urlstring, "http://www.google.com/accounts") > 0) Or (InStr(urlstring2, "https://www.google.com/accounts") > 0) Then
    4. MsgBox "Connected"
    5. Else
    6. MsgBox "Disconnected"
    7. End If
    8. 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

  3. #3
    PoorPoster iPrank's Avatar
    Join Date
    Oct 2005
    Location
    In a black hole
    Posts
    2,729

    Re: strange problem with webbrowser control

    Check the URLs. Looks like they are invalid.
    Usefull VBF Threads/Posts I Found . My flickr page .
    "I love being married. It's so great to find that one special person you want to annoy for the rest of your life." - Rita Rudner


  4. #4

    Thread Starter
    Frenzied Member litlewiki's Avatar
    Join Date
    Dec 2005
    Location
    Zeta Reticuli Distro:Ubuntu Fiesty
    Posts
    1,162

    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

  5. #5
    PowerPoster
    Join Date
    May 2006
    Location
    Location, location!
    Posts
    2,673

    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.

  6. #6

    Thread Starter
    Frenzied Member litlewiki's Avatar
    Join Date
    Dec 2005
    Location
    Zeta Reticuli Distro:Ubuntu Fiesty
    Posts
    1,162

    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??

  7. #7

    Thread Starter
    Frenzied Member litlewiki's Avatar
    Join Date
    Dec 2005
    Location
    Zeta Reticuli Distro:Ubuntu Fiesty
    Posts
    1,162

    Re: strange problem with webbrowser control

    any ideas ,iam stuck!!

  8. #8
    PowerPoster
    Join Date
    May 2006
    Location
    Location, location!
    Posts
    2,673

    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
  •  



Click Here to Expand Forum to Full Width