Hello,
I wrote an object in C++/ATL that converts HTML to image by using the CLSID_WebBrowser control.
It does pretty standard stuff:
CoCreateInstance(CLSID_WebBrowser, NULL, CLSCTX_SERVER (or CLSCTX_INPROC_SERVER),
IID_IUnknown, (void**)&ptrIUnknown);
ptrIUnknown->QueryInterface(IID_IWebBrowser2, (void **)&m_ptrBrowser2);
also calls SetClientSite, connects to and handles the DWebBrowserEvents2 (BeforeNavigate2, DocumentComplete), does m_ptrOleObject->DoVerb, etc.
In the end, it uses IViewObject->Draw().
Everything works works beautifully when the object is called from a stand-alone application. However, when I call it from a server-side (ASP or
ASP.NET) environment, the whole thing crashes very early on, at the line
CComBSTR bstrBlank = L"about:blank";
m_ptrBrowser2->Navigate(bstrBlank, &varEmpty, &varEmpty, &varEmpty, &varEmpty);
I get the nasty 0xC0000005: Access Violation.
I have a .NET application in my possession that does pretty much the same thing, (but written in C#) and it works reasonably well! So apparently this is doable.
Another odd thing is if I compile my C++ project for the AMD64 platform (64-bit) it does not crash but still does not work well, complex web pages still do not convert properly, etc.
I am at my wits end. Any ideas, please? Thanks a lot in advance.
-- DC Dweller