Board index » delphi » I am trying to log in mail.yahoo.com programmingly but...
connie tsolekas
![]() Delphi Developer |
I am trying to log in mail.yahoo.com programmingly but...2004-09-17 08:59:18 PM delphi219 Hi everyone, While I am trying to log in mail.yahoo.com thru application written in Delphi, I noticed that the below code was not working properly: WebBrowser1.OleObjects.Document.form_1.loginid.value := 'userid'; WebBrowser1.OleObjects.Document.form_1.passwd.value := 'password'; WebBrowser1.OleObjects.Document.form_1.submit; /* the below line is not processed */ while WebBrowser1.ReadyState <>READYSTATE_COMPLETE do Application.ProcessMessages; GetHTMLsource( WebBrowser1, Memo1 ); --------- I expected to obtain HTML in result page after logged in, however, Delphi didn't take "while" statement above because WebBrowser1.ReadyState is already READYSTATE_COMPLETE. I guess the Delphi does set WebBrowser1.ReadyState to "Navigating" ( or something else) in case of starting navigation by calling Navigate method. So I tried to catch OnDocumentComplete event as below: procedure TWebBrowser1.OnDocumentComplete(..., URL:OleVariant;); begin if Pos( 'us.f148.mail.yahoo.com', URL ) then GlobalVariable := 'Logged'; end; WebBrowser1.OleObjects.Document.form_1.submit; while GlobalVariable <>'Logged' do Application.ProcessMessages; // Thru above codes, I got the correct HTML from the logged web page, however, I realized that it is not almost possible to close the application even though I put "Application.ProcessMessages" in while statement. Why? I clicked the [x] button on the title bar many times while logging in mail.yahoo.com, but the application didn't response at all. First of all, I don't think the way using OnDocumentComplete is a good way. If anyone knows about this issue, please let me know how I can figure this out. thanks in advance, -connie |