Q132288
Calling ExtTextOut in a CView's OnDraw or OnPaint routine causes an
assertion failure when Print Preview is used. The assertion failure occurs
only when the lpszString parameter points to read-only memory. The
assertion failure will occur on one of the following lines:
DCPREV.CPP - Line 588
DCPREV.CPP - Line 592
DCPREV.CPP - Line 594
The cause is in an incorrect ASSERT statement in the CPreviewDC::ExtTextOut function as follows:
...
ASSERT(AfxIsValidAddress(lpszString, nCount));
...
The documentation states (correctly) that AfxIsValidAddress takes an
optional third parameter that specifies whether the memory is to be used
for both reading and writing. It defaults to TRUE.
Modify the call to ExtTextOut so that it passes non-read-only memory to the function. This can be done by storing your string data in a different location or by making a copy of the string data before calling the ExtTextOut function.
Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article. This problem was fixed in Microsoft Visual C++, 32-bit Edition, version 4.0.
Additional query words: 1.50 1.51 1.52 2.50 2.51 2.52 2.00 2.10 3.00 3.10
Keywords : kbDocView kbGDI kbMFC kbVC150bug kbVC200bug kbVC210bug kbVC400fix kbGrpDSMFCATL kbNoUpdate
Issue type : kbbug
Technology : kbAudDeveloper kbMFC
|
Last Reviewed: July 29, 2001 |