I was searching here on SO, but without success or any acceptable answer.
I have bigger application, which is using TEmbeddedWB. Lets say my code is like this:
// here is some other code where I am working with EmbeddedWB1
EmbeddedWB1.Navigate2('http://www.stackoverflow.com');
while EmbeddedWB1.ReadyState <> READYSTATE_COMPLETE do
begin
EmbeddedWB1.Stop;
Application.ProcessMessages;
end;
EmbeddedWB1.Navigate2('http://www.google.com');
And this code is stuck inside that loop.
When debugging, EmbeddedWB1.ReadyState = READYSTATE_LOADING
.
Could somebody tell me, how to definitelly stop loading of page, and move on to the next navigate?
Thanks a lot.
PS: without that loop, it can normally load another page, f.e. google.com. But I really need to have it in READYSTATE_COMPLETE
before loading another page.
It's not exiting the loop because you're specifically telling it not to do so until the
ReadyState
isREADYSTATE_COMPLETE
, and then callingStop
so it can never reach thatReadyState
.Follow the logic:
{ 1 }
says "Stay in the loop until ReadyState is READYSTATE_COMPLETE".{ 2 }
says "Stop loading the page", which meansReadyState
can never beREADYSTATE_COMPLETE
You're intentionally preventing your loop from exiting.
If you want to actually stop loading the page and exit the loop, put in a counter or timer, and add a condition to the loop to allow you to exit if the condition is met: