1.00
WINDOWS
kb3rdparty
The information in this article applies to:
- Microsoft Visual C++ for Windows, version 1.0
SUMMARY
There are many differences between the source code provided in the
Microsoft Press book "Inside Visual C++" by David J. Kruglinski and the
source code on the disk that ships with the book. The book contains other
errors that are described below.
MORE INFORMATION
- Section 4, page 112:
- All references to "CEX06aDialog" should be changed to "CEx06aDialog"
to match the existing source code in the files EX06ADLG.H and
EX06ADLG.CPP.
- The prototype that the user should to add to EX06ADLG.H should be
changed from
void CEx06aDialog::OnOK();
to
virtual void OnOK();
- Section 4, page 114:
In the CEx06aDialog::OnHScroll function in the book, the three
occurrences of the line "pScrollBar->GetScrollRange(&nMin, &nMax)" in
the switch statement are not in the source code found on the sample
disk. The line "pScrollBar->GetScrollRange(&nMin,&nMax)" is needed at
the beginning of each one of the case statements to set the minimum
and maximum values of the scroll bar before the thumbpad position can
be changed.
- Section 11, page 122:
The line, "pDC->TextOut(0,0,'Press the left mouse button here.');"
should be highlighted.
- Section 10, page 130:
The phrase in the second include statement, "ex07bdlg.h", should be
replaced with "ex07bvw.h".
- Section 10, page 131, paragraph 1:
The fourth line should have the acronym "DLL" rather than "DDL".
- Section 8, page 205:
In the file EX12BVW.CPP, the source code in the book for function
"OnCreate" is different than the source code provided on the sample
disk. In this instance, the source code in the book is the better
version to use. The following code is an example of
CEx12bView::OnCreate as shown in the book:
int CEx12bView::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if(CEditView::OnCreate(lpCreateStruct) != 0)
{
return -1;
}
VERIFY(m_pFont->CreateFont(12,0,0,0,400,FALSE,FALSE,0,
ANSI_CHARSET,OUT_DEFAULT_PRECIS,
CLIP_DEFAULT_PRECIS,DEFAULT_QUALITY,
DEFAULT_PITCH | FF_SWISS,"Arial"));
SetFont(m_pFont);
return 0;
}
The same function on the sample disk has three major differences:
- An unreferenced variable, "CFont font", is included at the
beginning of the function.
- The if statement in the function checks to see whether CEditView::
OnCreate equals -1 instead of another non-zero value.
- The function uses the ASSERT macro instead of the VERIFY macro.
ASSERT evaluates and checks its argument only in DEBUG mode while
VERIFY passes its argument to ASSERT in DEBUG mode and evaluates
the argument itself in RELEASE mode without checking the result.
- Section 9, page 252:
The first highlighted line in the function "OnClickedEnter" is
missing a semicolon at the end.
|