Click to See Complete Forum and Search --> : createElement gets Error in release version


RyanWool
September 14th, 2007, 12:43 AM
Hi,

I have a segment of code working fine in debug mode but got error in release version.

case DISPID_DOCUMENTCOMPLETE:

HRESULT hr;
CComQIPtr<IWebBrowser2> browser=pDispParams->rgvarg[1].pdispVal;
CComPtr<IDispatch> spdspDoc;
hr=browser->get_Document(&spdspDoc);
if(SUCCEEDED(hr))
{
CComQIPtr<IHTMLDocument2,&IID_IHTMLDocument2> pHtmlDocument2(spdspDoc);
if(pHtmlDocument2)
{
......
CComPtr<IHTMLElement> spEle;
hr = pHtmlDocument2->createElement(L"DIV", &spEle); // this line got error


I got error like this:

First-chance exception at 0x7dc9f58c in IEXPLORE.EXE: 0xC0000005: Access violation reading location 0x01e4f000.
Unhandled exception at 0x7dc9f58c in IEXPLORE.EXE: 0xC0000005: Access violation reading location 0x01e4f000.

Anybody knows why? Thank you very much!