Hello,

Using this code I can set HTML for currently displaying document:

    // create stream to put string in
    nsresult rv;
nsCOMPtr<nsIStringInputStream> inputStream( do_CreateInstance("@mozilla.org/io/string-input-stream;1", &rv) );
    if (NS_FAILED(rv)) return false;

    // convert our string to stream
    inputStream->SetData( data.mb_str(), data.length() );

    // get document shell
nsCOMPtr<nsIDocShell> docShell( do_GetInterface(m_ptrs->m_web_browser) );
    NS_ENSURE_TRUE(docShell, NS_ERROR_FAILURE);

    // finally, load the stream we made!
    rv = docShell->LoadStream( inputStream, NULL /*URI*/,
                               NS_LITERAL_CSTRING("text/html"),
#if wxUSE_UNICODE
                               NS_LITERAL_CSTRING("UTF-8"),
#else
nsCAutoString( wxLocale::GetSystemEncodingName() ),
#endif
                               NULL /*loadInfo*/ );
    if (NS_FAILED(rv)) return false;

The document appears just after I use this snippet. If I use nsIWebBrowserStream's methods (OpenStream, AppendToStream, CloseStream) to set HTML code for currently displayed browser window it remains unchanged!

How can I apply these changes?

Thanks,
Ilya
_______________________________________________
dev-embedding mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-embedding

Reply via email to