Lukas H. wrote:
Hi all,
I have started to play with ActiveX Mozilla from Adam Lock.
What I want to do is create a simple browser that will get all
the pages from the string.
All the links will contain some information that will tell the
application
what should be shown to the browser (some another string again
generated by application). I believe, BeforeNavigate(...) should do
the job.
What I am not able to do now is to load a string into the Mozilla
ActiveX
control. I used the code that works under IE, but Mozilla ignores it.
The "about:blank" is pre-loaded, before calling the test2() method.
On the line
hr = lpDispatch->QueryInterface( IID_IPersistStreamInit,
(void**)&pPersistStreamInit );
it returns E_NOINTERFACE.
How make it works?
Thanks for any comment.
void CReaderDlg::test2(void)
{
HRESULT hr;
HGLOBAL hHTMLText;
IPersistStreamInit* pPersistStreamInit = NULL;
IStream* pStream = NULL;
static char szHTMLText[] = "<html><h1>Stream Test</h1><body><p>This HTML
content is being loaded from a stream.</body></html>";
//get a pointer to the document.
LPDISPATCH lpDispatch = m_explorer.get_Document();
// Query for IPersistStreamInit.
hr = lpDispatch->QueryInterface( IID_IPersistStreamInit,
(void**)&pPersistStreamInit );
//********* HERE IT RETURNS E_NOINTERFACE *************
if ( SUCCEEDED(hr) )
{
// Initialize the document stream.
hr = pPersistStreamInit->InitNew();
if ( SUCCEEDED(hr) )
{
// Create a stream containing the HTML.
// Alternatively, this stream may have been passed to us.
hHTMLText = GlobalAlloc( GPTR, lstrlen(szHTMLText)+1 );
if ( hHTMLText )
{
lstrcpy( (char*)hHTMLText, szHTMLText );
hr = CreateStreamOnHGlobal( hHTMLText, TRUE, &pStream );
if ( SUCCEEDED(hr) )
{
// Load the contents of the stream.
hr = pPersistStreamInit->Load( pStream );
}
}
GlobalFree( hHTMLText );
pPersistStreamInit->Release();
}
lpDispatch->Release();
}
}
Hi Lukas,
Many interfaces and many methods in interfaces are not implemented.
For exemple IPersistStreamInit. I have implemented IsDirty and Save, for
pStm == NULL, but it may take some time before I can have that checked in.
Alex
_______________________________________________
mozilla-embedding mailing list
[EMAIL PROTECTED]
http://mail.mozilla.org/listinfo/mozilla-embedding