0

I am developing a native application using C++ Builder. I have added an internal browser control (using the supplied TCppWebBrowser class) to the application (a first for me :-)). This control currently uses an external HTML file to start things up. So far, So good...

I have seen a similar application written in VB.NET and there I saw that you could command the browser control (System.Windows.Forms.WebBrowser) to load an internal content (i mean HTML page). It was something like this:

theWebBrowser.DocumentText = theStringThatHoldsTheContent

Does anybody know TCppWebBrowser class or any queried interface through it has this functionality ? Any URL, InterfaceName, snippet is OK...

Thanks In Advance...

Johan
  • 74,508
  • 24
  • 191
  • 319
Malkocoglu
  • 2,522
  • 2
  • 26
  • 32
  • possible duplicate of [How do I open links from a TCppWebBrowser component in the systems default browser](http://stackoverflow.com/questions/1558768/how-do-i-open-links-from-a-tcppwebbrowser-component-in-the-systems-default-brows) –  Jun 22 '12 at 13:22
  • No, it is not a duplicate. Thanks to Remy, I can move on... – Malkocoglu Jun 25 '12 at 08:24
  • See this related post, It may be useful for you. http://stackoverflow.com/questions/10637550/detecting-external-content-with-tembeddedwb-or-twebbrowser/10647630#10647630 – mh taqia Jul 03 '12 at 14:36

1 Answers1

1

Navigate the browser to the "about:blank" URL, wait for the navigation to finish, then you can query the Document property for the IPersistStreamInit interface and call its Load() method. It takes an IStream interface as input. You can use the VCL's TStreamAdapter class to wrap any VCL TStream object, such as a TMemoryStream (TStreamAdapter implements the IStream interface). You can then store your HTML in the TStream as needed.

Remy Lebeau
  • 555,201
  • 31
  • 458
  • 770