Hi!

Im using a webbrowser control, and i want to read the html source immediately, as it arrives in more parts, dont want to wait until the whole document downloaded. I look for an element with specified id, and when its present in the arrived part of html, invoke click() method. Is there any event would be good for me, or any other ways to do that?

Thank you

(sorry for my english, hope its understandable)

Recommended Answers

All 2 Replies

HttpWebRequest request = (HttpWebRequest)WebRequest.Create( uri );
(HttpWebResponse)request.BeginGetResponse(AsyncCallBackDelegate, state);

After what you catch in the delegate method each time a block is downloaded and when you find the desired item stop the async call. You can also change some properties to set the chunk of information you want to download at a time.

Thank you, but i have to do this using the wpf Webbrowser controls Navigate() function. It has some lifecycle events, but not enough for me. I have tried HTMLDocumentEvents2_Event ondataavailable event.I havent find much resource for this event but looks good for me, but it never fires, until the document downloads.

mshtml.HTMLDocumentEvents2_Event iEvent =(HTMLDocumentEvents2_Event)MyBrowser.Document;
iEvent.ondataavailable += new HTMLDocumentEvents2_ondataavailableEventHandler(iEvent_ondataavailable);

MyBrowser is a wpf Webbrowser control, defined in xaml. I dont know when it should fire, but it never does.

However onmouseover works... for a while. It fires only ca. 30 times, then stops, but thats another problem.

iEvent.onmouseover +=new HTMLDocumentEvents2_onmouseoverEventHandler(iEvent_onmouseover);

Is somebody familiar with HTMLDocumentEvents2?

Thank you!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.