I am developing a visual c++ application for creating preview handler. The problem occurs when i for some reason i need to do CoCreateInstance() for IXMLDOMDocument *pDomDoc; inside the static function (pay attention here). and the syntax is as follows-
//this CreateHtmlPreview is declared static somewhere in my code
HRESULT AMEPreviewHandler:: CreateHtmlPreview(AMEPreviewHandler* instance)
{
IStream *m_FinalHTMLStream;
ULONG pcbWritten;
HRESULT hrs = CreateStreamOnHGlobal(NULL, TRUE, &m_FinalHTMLStream);
HRESULT hrp = m_FinalHTMLStream->Write(&(instance->m_HtmlFileContents),(instance->m_SizeOfFile)-1, &pcbWritten);
IXMLDOMDocument *pDomDoc;
HRESULT hr = CoCreateInstance(__uuidof(DOMDocument60), NULL, CLSCTX_INPROC_SERVER, IID_PPV_ARGS(&pDomDoc));
//the problem is here that this hr on debugging gives EFAIL
if (SUCCEEDED(hr))
{
................Something..something.......
}
}
Is that due to static declaration of the function.If NO ?? Then what could be the reason for this EFAIL ???