Windows do not have a readyState property, but as a document container I need a way to determine whether a document is instantiated. After a .navigate I can check the readyState of InternetExplorer or the WebBrowser control to see if it is safe to start working with the .document. With a window (and frame as window) I can find now way to do the same. Am I missig something or am I forced into having to trap errors trying to reference the document object? Thanks, Dale
"DaleH" wrote in message news:D7CFEF8D-9DC8-4C12-AC52-5724BABF58D8@microsoft.com > Windows do not have a readyState property, but as a document > container I need a way to determine whether a document is > instantiated. > > After a .navigate I can check the readyState of InternetExplorer or > the WebBrowser control to see if it is safe to start working with the > .document. With a window (and frame as window) I can find now way to > do the same. I'm not sure I understand your question. You get NavigateComplete2 event when the first byte of the response has arrived. At this point, you have access to window and document objects, but the DOM underneath the document is incomplete. Once DocumentComplete event arrives, the document is fully loaded and you can work with the DOM. You get these events from each frame independently (one of parameters to these events tells you which frame the event has come from). -- With best wishes, Igor Tandetnik With sufficient thrust, pigs fly just fine. However, this is not necessarily a good idea. It is hard to be sure where they are going to land, and it could be dangerous sitting under them as they fly overhead. -- RFC 1925
It's not a traditional application where I have full control over logic and flow, but rather a set of generalized scripting routines. I have a function called _IELoadWait that accepts an object reference and then loops waiting for the appropriate objects to quiesce befor returning. So the logic does not allow me to monitor event delivery on the object. InternetExplorer, WebBrowser and Document all have a .readyState property that I can check and when it is "complete" or 4 I can move on. After a ..navigate, readyState for InternetExplorer and WebBrowser do not change to complete until the document object they contain is accessible (I then wait for the readyState of the document to complete as well). I need a way to do the same starting with a window object. Make sense? Dale
"DaleH" wrote in message news:7C5A37BD-8833-472C-A998-67A1BF07F68F@microsoft.com > So the logic does not allow me to monitor event delivery on the > object. InternetExplorer, WebBrowser and Document all have a > .readyState property that I can check and when it is "complete" or 4 > I can move on. After a .navigate, readyState for InternetExplorer > and WebBrowser do not change to complete until the document object > they contain is accessible (I then wait for the readyState of the > document to complete as well). I need a way to do the same starting > with a window object. If you have a window, you also have access to the document via window.document, at which point you can use readyState. -- With best wishes, Igor Tandetnik With sufficient thrust, pigs fly just fine. However, this is not necessarily a good idea. It is hard to be sure where they are going to land, and it could be dangerous sitting under them as they fly overhead. -- RFC 1925
Correct, but there is a period in time where window.document.readyState returns "requested action with this object has failed". This is what I am trying to avoid. When I start with an InternetExplorer object I can check InternetExplorer.readyState first... if it is ready I never get an error with InternetExplorer.document.readyState -- I'm trying to replicate this logic starting with a window. Dale
"DaleH" wrote in message news:D374539D-CC96-4CC3-A669-1E7DA0D54E10@microsoft.com > Correct, but there is a period in time where > window.document.readyState returns "requested action with this object > has failed". This is what I am trying to avoid. When I start with > an InternetExplorer object I can check InternetExplorer.readyState > first... if it is ready I never get an error with > InternetExplorer.document.readyState -- I'm trying to replicate this > logic starting with a window. OK, try this. Query the window (or document, should work for either) object for IServiceProvider, call QueryService with SID_STopLevelBrowser to get IWebBrowser2 interface for the top-level browser. You can also use SID_SWebBrowserApp to get IWebBrowser2 for immediately enclosing browser object (may be top-level browser or a frame). -- With best wishes, Igor Tandetnik With sufficient thrust, pigs fly just fine. However, this is not necessarily a good idea. It is hard to be sure where they are going to land, and it could be dangerous sitting under them as they fly overhead. -- RFC 1925
Thanks Igor. I appreciate your attentiveness to these forums and your thoughtful resonses. I was hoping I was missing something obvious in the object model. Dale