is there a way to know that the WebBrowser control has finished loading the page?
currently i am using WebBrowser.ReadyState == WebBrowserReadyState.Complete.
but this indicates that the webpage content is downloaded but sometimes the flash is not loaded yet.
views:
290answers:
3
+3
A:
A Flash file loading doesn't report its progress on that back to the browser so unfortunately you can't catch that.
Joey
2010-01-03 21:00:26
Yup. Same problem with Javascript.
Hans Passant
2010-01-03 21:14:35
A:
The WebBrowser
control has a DocumentCompleted
event which you can catch and react on. I don't know if that includes the Flash content loading - the docs aren't very clear on that....
webBrowser1.DocumentCompleted +=
new WebBrowserDocumentCompletedEventHandler(webBrowser1_DocumentCompleted);
private void webBrowser1_DocumentCompleted(object sender,
WebBrowserDocumentCompletedEventArgs e)
{
// do whatever you need to do when the document is completely loaded here
}
marc_s
2010-01-03 21:02:25
but even so, it's easier and more efficient than constantly polling for `WebBrowser.ReadyState == WebBrowserReadyState.Complete.`
marc_s
2010-01-03 21:43:38
yeah but i am running several Webbrowsers on several worker threads, so the code got messy when i tried to implement events. so i left it like that. sure the cpu is @ 100% all the time but i need the task to get done. :)
Karim
2010-01-03 21:45:22
A:
well the best thing i have found is to use a timer to wait for a specifique time like 30 seconds and then the page should be loaded.
not perfect but the best i have thought of.
Karim
2010-01-04 12:09:15