Board index » delphi » I am trying to log in mail.yahoo.com programmingly but...

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
 
 

Re:I am trying to log in mail.yahoo.com programmingly but...

"connie tsolekas" <XXXX@XXXXX.COM>writes
Quote
/* the below line is not processed */
while WebBrowser1.ReadyState <>READYSTATE_COMPLETE do
Application.ProcessMessages;
Try this instead:
repeat
Application.ProcessMessages;
until WebBrowser1.ReadyState = READYSTATE_COMPLETE
Quote
I realized that it is not almost possible to close the application even
though I put "Application.ProcessMessages" in while statement. Why?
Your loop is not allowing the program to close. You should be checking the
Application.Terminated property as well, and if set to true then break out
of your loop.
Quote
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.
It responds fine. Your code is simply continuing to loop and not allowing
the form to do anything.
Gambit