Solved

problem facing with IHTMLDocument2::write function

Posted on 2012-12-21
3
837 Views
Last Modified: 2013-01-14
I am facing two problems when the control of my project comes at IHTMLDocument2::write" function.The problems are as follows..

1. My project is going in hang stag .
2. It throws exception at the same point.

i have attached two html files , abc.html and xyz.html for respected problems.

The code what i am using is to write HTML expressions to a document is::

SAFEARRAY* psa = NULL;
            
HRESULT hr;
CComPtr<IHTMLDocument2> pDoc;
pDoc = NULL;
hr = CoCreateInstance(CLSID_HTMLDocument, NULL, SCTX_INPROC_SERVER,
                                    IID_IHTMLDocument2, (void**)&pDoc);

if(!strHtmlText.IsEmpty() && SUCCEEDED(hr))
{                  
      psa = SafeArrayCreateVector(VT_VARIANT, 0, 1);
                                          
      VARIANT *param;

      if(psa && SUCCEEDED(SafeArrayAccessData(psa, (LPVOID*)&param)))
      {
            CComBSTR bstrHTML(strHtmlText);
            VariantInit(param);
            param->vt = VT_BSTR;
            param->bstrVal = bstrHTML.m_str;
                                                                  
            if(SUCCEEDED( pDoc->write(psa)))
            {
//--------------------------------------------------//
}

}|
}
abc.html
xyz.html
0
Comment
Question by:davinder101
  • 2
3 Comments
 
LVL 8

Expert Comment

by:Pramod Bugudai
ID: 38723130
Hi,

I can see that you have a COM DLL, from which you are trying to call the methods to create your HTML documents. Whether you tested your COM DLL to check its working fine. I guess something its not able to find out the process address of routines in that DLL. That is the reason its hanging your application.

Exceptions are may from your program. Try debugging the application where exactly it starts hanging your app.


regards,
0
 

Author Comment

by:davinder101
ID: 38725894
hi,

i have tested this piece of code on a dialog based application too.

just add this piece of code on a click event on a dialog based application
it hangs on even on that.

please check it at your end too...
it will hang...
0
 
LVL 8

Accepted Solution

by:
Pramod Bugudai earned 500 total points
ID: 38726564
I was trying to tell you for proper debugging so that exactly you can find where it starts hanging and then crashing the app.Not sure what is there in your code. But while googling I got these links, which will be helpful for you.

http://msdn.microsoft.com/en-us/library/aa703592(v=vs.85).aspx
http://www.codeproject.com/Articles/1788/Loading-and-parsing-HTML-using-MSHTML-3rd-way


Put a search in google "CoCreateInstance(CLSID_HTMLDocument" you will get more links. That may help you more.

Regards,
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

The following diagram presents a diamond class hierarchy: As depicted, diamond inheritance denotes when two classes (e.g., CDerived1 and CDerived2), separately extending a common base class (e.g., CBase), are sub classed simultaneously by a fourt…
In Easy String Encryption Using CryptoAPI in C++ (http://www.experts-exchange.com/viewArticle.jsp?aid=1193) I described how to encrypt text and recommended that the encrypted text be stored as a series of hexadecimal digits -- because cyphertext may…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

943 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

7 Experts available now in Live!

Get 1:1 Help Now