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 don't 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 don't 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));
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 ((m_pStyleSheetNode) == NULL)
{
hr = CreateStyleSheetNode();
//This function creates the stylesheet and defined somewhere in my code.
}
if (SUCCEEDED(hr))
{
BSTR bstrRtf;
hr = pDomDoc->transformNode((m_pStyleSheetNode), &bstrRtf);
if (SUCCEEDED(hr))
{
hr = 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 same for html files ? ?I want to do same type of thing for HTML file. Understood ??? if not please ask me again ??
see this to understand what actually I want to do- what I want to do is that I have stream which has contents of any html file(IStream *m_FinalHTMLStream;). how I got the stream is not a matter for now.what is important now is that it contains the contents of a html file(if you open any html file in notepad-_FinalHTMLStream contains the same contents inside it).now as you can see that when we have a html file in window exploror and if we single click on it we can see the html file preview in previewpane.I want to do the same. For doing this we need to have the html file contents store some where(In my case I have in the _FinalHTMLStream) . for doing the same with XML files the code is as above but I don't know how to do that with html files. So thats what I want. Understood now ??if not then please let me know ??
i am creating my own preview handler hor .html file this is what I am doing(in short and precise)..