S
Shekhar SHEKHAWAT
Guest
I am developing a Visual c++ application and i have to develp preview handler for HTML preview in preview pane. I have idea of doing the same for Xml documents(for xml files they create style sheet to accomplish this task) but i dont know how to do that for .html file.
If i am right then i have to do something like this-
IHTMLDocument * pDomDoc;
HRESULT hr = CoCreateInstance(CLSID_HTMLDocument, NULL, CLSCTX_INPROC_SERVER,
IID_IHTMLDocument2, (void**)&pDomDoc);
I dont know what after that ??
Any ideas ??
I mean i know how to do this for XML files for them it is as follows-
IXMLDOMDocument *pDomDoc;
IStream *m_FinalXMLStream;
HRESULT hr = CoCreateInstance(__uuidof(DOMDocument60), NULL, CLSCTX_INPROC_SERVER, IID_PPV_ARGS(&pDomDoc));
MessageBoxA((instance->m_hwndPreview),strerror(hr),"BTN WND", MB_ICONINFORMATION);
if (SUCCEEDED(hr))
{
VARIANT_BOOL vfSuccess = VARIANT_FALSE;
VARIANT vtXmlSource = {0};
V_VT(&vtXmlSource) = VT_UNKNOWN;
V_UNKNOWN(&vtXmlSource) = static_cast<IUnknown *>(m_FinalXMLStream);
//here m_FinalXMLStream is the stream cpntaining the contents of XML file
hr = pDomDoc->load(vtXmlSource, &vfSuccess);
if (vfSuccess != VARIANT_TRUE)
{
hr = FAILED(hr) ? hr : E_FAIL; // keep failed hr
}
if (SUCCEEDED(hr))
{
if ((instance->m_pStyleSheetNode) == NULL)
{
hr = instance->CreateStyleSheetNode();
//This function creates the stylesheet and defined somewhere in my code.
}
if (SUCCEEDED(hr))
{
BSTR bstrRtf;
hr = pDomDoc->transformNode((instance->m_pStyleSheetNode), &bstrRtf);
if (SUCCEEDED(hr))
{
hr = instance->CreatePreviewWindowForXml(bstrRtf);
//This function call creates the window dimension where to preview the Xml contents
SysFreeString(bstrRtf);
}
}
}
pDomDoc->Release();
}
Any idea of how to do the sam for html files ? ?I want to do same type of thing for HTML file. Understood ??? if not please ask me again ??
Continue reading...
If i am right then i have to do something like this-
IHTMLDocument * pDomDoc;
HRESULT hr = CoCreateInstance(CLSID_HTMLDocument, NULL, CLSCTX_INPROC_SERVER,
IID_IHTMLDocument2, (void**)&pDomDoc);
I dont know what after that ??
Any ideas ??
I mean i know how to do this for XML files for them it is as follows-
IXMLDOMDocument *pDomDoc;
IStream *m_FinalXMLStream;
HRESULT hr = CoCreateInstance(__uuidof(DOMDocument60), NULL, CLSCTX_INPROC_SERVER, IID_PPV_ARGS(&pDomDoc));
MessageBoxA((instance->m_hwndPreview),strerror(hr),"BTN WND", MB_ICONINFORMATION);
if (SUCCEEDED(hr))
{
VARIANT_BOOL vfSuccess = VARIANT_FALSE;
VARIANT vtXmlSource = {0};
V_VT(&vtXmlSource) = VT_UNKNOWN;
V_UNKNOWN(&vtXmlSource) = static_cast<IUnknown *>(m_FinalXMLStream);
//here m_FinalXMLStream is the stream cpntaining the contents of XML file
hr = pDomDoc->load(vtXmlSource, &vfSuccess);
if (vfSuccess != VARIANT_TRUE)
{
hr = FAILED(hr) ? hr : E_FAIL; // keep failed hr
}
if (SUCCEEDED(hr))
{
if ((instance->m_pStyleSheetNode) == NULL)
{
hr = instance->CreateStyleSheetNode();
//This function creates the stylesheet and defined somewhere in my code.
}
if (SUCCEEDED(hr))
{
BSTR bstrRtf;
hr = pDomDoc->transformNode((instance->m_pStyleSheetNode), &bstrRtf);
if (SUCCEEDED(hr))
{
hr = instance->CreatePreviewWindowForXml(bstrRtf);
//This function call creates the window dimension where to preview the Xml contents
SysFreeString(bstrRtf);
}
}
}
pDomDoc->Release();
}
Any idea of how to do the sam for html files ? ?I want to do same type of thing for HTML file. Understood ??? if not please ask me again ??
Continue reading...