|
-
August 6th, 2009, 05:02 AM
#9
Re: doPostBack then view source not updated
 Originally Posted by PeejAvery
If you're attempting to handle this through a control, then you are severly limited. The WebBrowser control cannot directly access JavaScript events...which is what readyState is.
Out of curiosity, are you writing this in VB.NET? C#? What language?
The specifics are its a C++/MFC application.
Its a prgram that monitors a bunch of websites within a particular business domain for any changes at most once a day.
Previously the operators had to goto each site manually and try to work out if anything new had been added or anything taken away. Most sites it seems are not written using AJAX and each page has it owns url and can just use CInternetSession to download them as files and compare with the last one downloaded. Huge time saving and operators can now scan lots more.
Problem is now there is an important site written using AJAX that we want to monitor.
So when we add a site using AJAX the above is overridden to download via CWebBrowser control. Initially am deriving from CHTMLView.
Thanks to your help I can now traverse the 'next' links via executing
Navigate2("javascript:__doPostBack('ctl00$ContentPlaceHolder1$dgSearch','Page$12')")
For each page in the set. The current way im detecting when its ready is when the element text
is different from the previous with a sleep and doevents etc. Not confident with this approach and just want an event when download is complete. So then looked like could receive events for individual elements.
Now the problem initially for me was using this language how do you register an event handler
This article explains it.
http://support.microsoft.com/kb/q253915/
Its a little long winded if you look at the internals buts it really just a copy and paste excersise with a few modifications relative to your class.
Against the element receiving the update im executing
_variant_t varFO =
CFunctionObject<CViewHTMLCrawler>::CreateEventFunctionObject(this, &CViewHTMLCrawler::MyEventCallback, DISPID_READYSTATECHANGE);
hr = lpElem2->put_onreadystatechange(varFO);
ASSERT(hr == S_OK);
But the events never fire. Iv added it to the body element too. No events occur in CFunctionObject either, its not just readystatechange not occuring.
Thats where im at, would love to nail this one, one way or the other.
Hope this makes some sense.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|