Translate from C++ to C#

Tech-Archive recommends: Speed Up your PC by fixing your registry



Hi,

I would need the equivalent in C#, suggestion?

HRESULT LoadWebBrowserFromStream(IWebBrowser* pWebBrowser, IStream* pStream)
{
HRESULT hr;
IDispatch* pHtmlDoc = NULL;
IPersistStreamInit* pPersistStreamInit = NULL;

// Retrieve the document object.
hr = pWebBrowser->get_Document( &pHtmlDoc );
if ( SUCCEEDED(hr) )
{
// Query for IPersistStreamInit.
hr = pHtmlDoc->QueryInterface( IID_IPersistStreamInit,
(void**)&pPersistStreamInit );
if ( SUCCEEDED(hr) )
{
// Initialize the document.
hr = pPersistStreamInit->InitNew();
if ( SUCCEEDED(hr) )
{
// Load the contents of the stream.
hr = pPersistStreamInit->Load( pStream );
}
pPersistStreamInit->Release();
}
}
}


.



Relevant Pages

  • Re: How to implement IBindHost
    ... I tried to query IID_IPersistStreamInit to the Flash Activex, ... HRESULT hr = E_FAIL; ... DWORD fsize; ... See if Flash control implements IPersistStreamInit or IPersistMoniker. ...
    (microsoft.public.inetsdk.programming.webbrowser_ctl)
  • Re: Writing an HTML string to an mshtml.Document
    ... Public Interface IPersistStreamInit: Inherits IPersist ... ByVal fClearDirty As Boolean) As HRESULT ... >> The document object exposes the IPersistStreamInit interface. ... >> using the mshtml class and System.Net to retriver HTML pages. ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Interfaces
    ... Because the calls are not failing. ... means success. ... you do not need to retrieve the HRESULT yourself. ...
    (microsoft.public.vb.general.discussion)