i am working in a code, in which they have used DHTML Edit Control(Dhtmled.ocx) to implement IE HTML editor sort of application. pasteHTML method is crashing when it get some strange HTML text. this is not happening at all the time. i have added the code below. but i cannot add the HTML code which is causing the problem ,since it is too huge text. this is happening at client's place only. this happens with Windows XP , IE6-SP3 it is working fine in Windows 2003 server with IE 7. I am passing HTML text as 1'st argument. i have searched all over the place in the net, but nobody discussed about the problem. i know microsoft dropped supporting DHTML Edit for long time before, but we can not migrate it to MSHTML, , because it will take long time for me to rewrite exact the code to simulate DHTML Edit control wrapper class in MSHTML, i have to give a fix for time being, Please throw me a clue if anybody have an idea, if 1. is there any way to find out a HTML tag which is causing the crash, 2. any workaround for pasteHTML method , . void CDHTMLEdit::ReplaceSel(LPCTSTR lpszNewText,bool bHTML/* = true */) { try { CHTMLSelectionObject SelObj = GetDom().GetSelection(); CString strText = SelObj.GetType(); LPDISPATCH lpIDispatch= SelObj.createRange(); IHTMLTxtRange * lpTxtRange; if(S_OK != lpIDispatch->QueryInterface(IID_IHTMLTxtRange,(void **)&lpTxtRange)) { lpIDispatch->Release(); return; } if(bHTML) { CComBSTR bstrReplaceText = lpszNewText;
lpTxtRange->pasteHTML(bstrReplaceText);
} else { CComBSTR bstrReplaceText = lpszNewText; lpTxtRange->put_text(bstrReplaceText); } lpTxtRange->collapse(false); lpTxtRange->select(); lpTxtRange->Release(); lpIDispatch->Release(); } catch(COleDispatchException * pDE) { FILETRACE(_T(" COleDispatchException caught in CDHTMLEdit::ReplaceSel.")); pDE->Delete(); ASSERT(FALSE); } catch(...) { FILETRACE(_T("CDHTMLEdit::ReplaceSel - Unhandled exception caught")); ASSERT(FALSE); } }