FIX: Print Preview Problems for Chars with ASCII Values > 127 (116299)
The information in this article applies to:
- The Microsoft Foundation Classes (MFC), when used with:
- Microsoft Visual C++ for Windows, 16-bit edition 1.0
- Microsoft Visual C++ for Windows, 16-bit edition 1.5
- Microsoft Visual C++, 32-bit Editions 1.0
This article was previously published under Q116299 SYMPTOMS
Microsoft Foundation Classes (MFC) library applications may have problems
performing a print preview of text that contains characters with ASCII
values greater than 127. The problems can range from uneven spacing of the
characters to a general protection fault (GPF) when you try to activate a
Print Preview.
CAUSE
The routine "CPreviewDC::ComputeDeltas()", located in the file DCPREV.CPP,
passes signed char values as the second and third parameters to the
function "::GetCharWidth()". However, ::GetCharWidth() takes unsigned
integer values for its second and third parameters. In the process of
converting from a signed char to an unsigned int, the wrong value is
passed to ::GetCharWidth(), and the function either returns incorrect
values or causes a GPF.
RESOLUTION
To avoid the problem, you can modify the file DCPREV.CPP and declare the
two variables "lpszCurChar" and "lpszStartRun" as being long pointers to
unsigned const characters. See the "MORE INFORMATION" section, below, to
see exactly what changes need to be made.
STATUS
Microsoft has confirmed this to be a bug in the products listed at the
beginning of this article. This problem was corrected in MFC version 3.0,
included with Visual C++ version 2.0.
Modification Type: | Major | Last Reviewed: | 12/2/2003 |
---|
Keywords: | kbbug kbfix kbprint KB116299 |
---|
|