3
votes

I am trying to use TWebBrowser in Console/Service type of application (without any windows). Navigate is definitely doing something, but it never calls onDocumentComplete. Is there any other way to get access to IHTMLDocument2 of some URL?

Thank you.

1
What, specifically, are you hoping to accomplish? TWebBrowser might not be your only option here. - Michael Madsen
If you want to download some HTML or whatever through HTTP you are better of with a HTTP Client like one from Indy - Lars Truijens
Do you just want to download something? stackoverflow.com/questions/4521535/… - Andreas Rejbrand
@Michael Madsen, I would prefer to have IE for redirects, cookies and so on. Plus, ultimate goal is to extract some text information from the web page. So, access to DOM would be pretty useful here. - Nipp
@Andreas Rejbrand, I am trying to implement "content watchdog". We have old in-house project that does the task. But it is not precise enough and gives ton of false-positives, when site changes some scripts on the web page. My thanks to everyone who sent the response. I will try Handle Needed method. Thou, it might be an issue if engine is used from non-interactive Service. We'll see. - Nipp

1 Answers

1
votes

Before using the TWebBrowser instance (e.g. with Navigate2), call its HandleNeeded method. This will allocate an 'invisible' parent window handle and straighten out any event issues.