HTML Code anzeigen
-
moin
ich hab nen char * array, in diesem char * array ist eine html seite zusammen gebaut. nun möchte ich (ohne den char* vorher in eine datei zu speichern) diesen html code anzeigen.
der html code bildet eine protokoll seite.
wie bekomm ich das hin ???
thx LT
-
Du könntest deine HTML-Seite per CHTMLView anzeigen. Wie das geht, findest du bei Google beziehungsweise auf dem folgenden Link:
http://lists.w3.org/Archives/Public/w3c-wai-ua/2000JanMar/att-0287/htmlevent.htm#DocumentGruß Kimmi
-
http://www.codeproject.com/KB/miscctrl/htmlctrlsample.aspx
^^ habs so gemacht
-
hmmm musste nun feststellen das dieser code zu programmabsürtzen führt...
if (this->m_bHTMLDocumentLoadedOK) return this->SetHTMLInDocument();
dieser code führt zum absturz
funktion:
bool CHTMLCtrl::SetHTMLInDocument() { SAFEARRAY *pSafeArray = NULL; VARIANT *pElement = NULL; IHTMLDocument2Ptr pHTMLDoc2 = NULL; LPDISPATCH lpDispatch = NULL; HRESULT hr; bool bRetorn = false; // Processat del document HTML, assignació de punters // i escriptura del contingut de la cadena de text. lpDispatch = this->GetHtmlDocument(); if (lpDispatch != NULL) { hr = lpDispatch->QueryInterface(IID_IHTMLDocument2, (LPVOID*)&pHTMLDoc2); if (!SUCCEEDED(hr)) { bRetorn = false; } else { pSafeArray = ::SafeArrayCreateVector(VT_VARIANT, 0, 1); if (pSafeArray) { hr = ::SafeArrayAccessData(pSafeArray,(LPVOID*) &pElement); if (!SUCCEEDED(hr)) { bRetorn = false; } else { pElement->vt = VT_BSTR; pElement->bstrVal = this->m_csHTMLContent.AllocSysString(); hr = SafeArrayUnaccessData(pSafeArray); if (!SUCCEEDED(hr)) { bRetorn = false; } else { pHTMLDoc2->clear(); pHTMLDoc2->close(); hr = pHTMLDoc2->write(pSafeArray); if (!SUCCEEDED(hr)) { bRetorn = false; } } SysFreeString(pElement->bstrVal); } if (pSafeArray) SafeArrayDestroy(pSafeArray); } if (pHTMLDoc2) { pHTMLDoc2->close(); pHTMLDoc2.Release(); } } lpDispatch->Release(); } return bRetorn; }
viellicht sieht ja jemand von euch nen fehler ...
-
Und wo bitte?
-
if (pSafeArray) SafeArrayDestroy(pSafeArray);
genau hier
-
habs behoben ...
if (pSafeArray) SafeArrayDestroy(pSafeArray);
durch
if (pSafeArray) delete [] pSafeArray;
ersetzt und schon gehts...