I have to admit that I do not have a book on the subject (small
company). I have however searched the internet hard and checked
forums and other C++ books that I have. I have found nothing that
comes close to this problem.

I didn't write this program so hopefully I can explain it well enough
to get some help.

We have a DHTML Edit Control for IE5 in our app. It has the .h and
..cpp files which appear to have been generated via ClassWizard. The
problem is in using the GetDocumentHTML function. Occasionally, when
a user edits text in the control and we then call GetDocumentHTML to
retrieve the html, it will sometimes mess up.

It will add a question mark before the DOCTYPE tag and it will put in
2 meta tags that do not have the same IE version number that I am
using. I have version 6 and the generated code will have

I believe a properly formed set of meta tags should look like this:

Notice the order of the parts of the first meta tag and the version
number in the 2nd meta tag.

I'm not sure what is causing the corruption, but it only happens
rarely. I've traced the code and it all seems fine until the
GetDocumentHTML function is called. Here is the code for the
GetDocumentHTML function.

CString CDHTMLEdit::GetDocumentHTML()
CString result;
InvokeHelper(0x11, DISPATCH_PROPERTYGET, VT_BSTR, (void*)&result,
return result;

Any help or pointing to help or even the name of a good book (I'll buy
it myself as my own) would be very much appreciated.