Wiley
Wiley.com
Print this page Share

Ivor Horton's Beginning Visual C++ 2008

ISBN: 978-0-470-22590-5
1392 pages
March 2008
Ivor Horton
Proudly presenting the latest edition of one of the all-time bestselling books on the C++ language, successful author Ivor Horton repeats the formula that has made each previous edition so popular by teaching you both the standard C++ language and C++/CLI as well as Visual C++ 2008. Thoroughly updated for the 2008 release, this book shows you how to build real-world applications using Visual C++ and guides you through the ins and outs of C++ development. With this book by your side, you are well on your way to becoming a successful C++ programmer.
See More
Acknowledgments.

Introduction.

Chapter 1: Programming with Visual C++ 2008.

Chapter 2: Data, Variables, and Calculations.

Chapter 3: Decisions and Loops.

Chapter 4: Arrays, Strings, and Pointers.

Chapter 5: Introducing Structure into Your Programs.

Chapter 6: More about Program Structure.

Chapter 7: Defining Your Own Data Types.

Chapter 8: More on Classes.

Chapter 9: Class Inheritance and Virtual Functions.

Chapter 10: The Standard Template Library.

Chapter 11: Debugging Techniques.

Chapter 12: Windows Programming Concepts.

Chapter 13: Windows Programming with the Microsoft Foundation Classes.

Chapter 14: Working with Menus and Toolbars.

Chapter 15: Drawing in a Window.

Chapter 16: Creating the Document and Improving the View.

Chapter 17: Working with Dialogs and Controls.

Chapter 18: Storing and Printing Documents.

Chapter 19: Writing Your Own DLLs.

Chapter 20: Connecting to Data Sources.

Chapter 21: Updating Data Sources.

Chapter 22: More on Windows Forms Applications.

Chapter 23: Accessing Data Sources in a Windows Forms Application.

Appendix A: C++ Keywords.

Appendix B: ASCII Codes.

Appendix C: Windows Message Types.

Index.

See More
Ivor Horton graduated as a mathematician and was lured into information technology by promises of great rewards for very little work. In spite of the reality being usually a great deal of work for relatively modest rewards, he has continued to work with computers to the present day. He has been engaged at various times in programming, systems design, consultancy, and the management of the implementation of projects of considerable complexity.
Horton has many years of experience in the design and implementation of computer systems applied to engineering design and to manufacturing operations in a variety of industries. He has considerable experience developing occasionally useful applications in a wide variety of programming languages, and teaching primarily scientists and engineers to do likewise. He has been writing books on programming for more than 10 years now, and his currently published works include tutorials on C, C++, and Java. At the present time, when he is not writing programming books or providing advice to others, he spends his time fishing, traveling, and trying to speak better French.
See More
Download TitleSizeDownload
Read Me file 1.65 KB Click to Download
All code and exercises from the book 1.35 MB Click to Download
Replacement Figure 1-10
This figure should replace Figure 1-10 in the book on page 18.
18.59 KB Click to Download
Chapter 2 code 9.31 KB Click to Download
Chapter 3 code 11.31 KB Click to Download
Chapter 4 code 14.96 KB Click to Download
Chapter 5 code 9.41 KB Click to Download
Chapter 6 code 24.71 KB Click to Download
Chapter 7 code 18.17 KB Click to Download
Chapter 8 code 20.45 KB Click to Download
Chapter 9 code 39.79 KB Click to Download
Chapter 10 code 25.59 KB Click to Download
Chapter 11 code 5.82 KB Click to Download
Chapter 12 code 2.51 KB Click to Download
Chapter 13 code 7.79 KB Click to Download
Replacement Figure 13-7
This figure should replace that in the book on page 789.
22.66 KB Click to Download
Chapter 14 code 47.00 KB Click to Download
Chapter 15 code 119.30 KB Click to Download
Chapter 16 code 176.92 KB Click to Download
Chapter 17 code 169.50 KB Click to Download
Chapter 18 code 205.14 KB Click to Download
Chapter 19 code 29.13 KB Click to Download
Chapter 20 code 95.17 KB Click to Download
Chapter 21 code 124.28 KB Click to Download
Chapter 22 code 61.61 KB Click to Download
Chapter 23 code 61.75 KB Click to Download
See More

Do you think you've discovered an error in this book? Please check the list of errata below to see if we've already addressed the error. If not, please submit the error via our Errata Form. We will attempt to verify your error; if you're right, we will post a correction below.

ChapterPageDetailsDatePrint Run
3 Error in Text
"because data and code is managed"

should be:

"because data and code are managed"
06/16/2008
21 Error in Text
"After you have entered the project name... click Applications Settings on the right side"

should be

"After you have entered the project name... click Applications Settings on the left side (right below Overview)"

11/13/08
47 Typo
represents a working program at it stands.

should be:
represents a working program as it stands.
08/25/08
55 Missing word
first paragraph under the heading "The Boolean Type":
"Boolean variables are variables can have only..."

should be:
"Boolean variables are variables that can have only..."
04/05/08
64 Typo
last line:
here

should be:
hear
09/02/08
64 Typo in Code
cout << "\n\tThe program\'s over, it\'s time take make a beep beep.\a\a";

Should be:
cout << "\n\tThe program\'s over, it\'s time to make a beep beep.\a\a";
10/4/11
86 Missing word
next to last paragraph under the heading "Understanding Storage Duration and Scope", 3rd sentence reads:
"either to set its value or to it in an expression."

should be:
"either to set its value or to use it in an expression."
04/05/08
96 Error in Text
the paragraph above the last block of grey highlighted information on the page, in the 3rd or next to last sentence, it reads:
"deliberately, but in can arise..." Should be: "deliberately, but it can arise..."
04/05/08
213 Error in Code
code listing:
for (int i = 0 ; i < sample->Length ; i++)

should be:
for (int i = 0 ; i < samples->Length ; i++)
08/04/08
225 Error in Text
Near bottom of page:

String^ formatStr1 = L"{0,"

Should be: String^ formatStr1 = L"{0,";
11/2/09
230 Error in Code
Second code snippet:

Console::WriteLine(L"The sentence does{0]

Should be:

Console::WriteLine(L"The sentence does{0}
11/2/09
231 Error in Text
On page 231, the end of the second paragraph before the "Try It Out" should say:

"...if the left operand of the && operator is false, the right operand is not evaluated"
1/15/09
233 Error in Text
Bottom of page 233 in the 'Interior Pointers' paragraph:

An interior point is always an automatic variable that is local to a function.

Should be

An interior pointer is always an automatic variable that is local to a function.
2/10/09
233 Error in Text
In the Tracking References section, paragraph 3:

The second statement defines stackValue to be a tracking reference to the variable value, which has been created on the stack. You can now modify value using stackValue:

Should be:

The second statement defines trackValue to be a tracking reference to the variable value, which has been created on the stack. You can now modify value using trackValue:
11/2/09
234 Error in Text
In the last sentence of the Try it Out, first word in line:

points.

should be:

pointers.
11/2/09
263 Error in Text
In section "Returning a Pointer", the line above the code block:

"Our first attempt the implement such a function..."

should be:

"Our first attempt to implement such a function..."
07/16/2008
366 Error in Text
Section Title: The Pointer this; 2nd paragraph:

Volume() function during execution, it's actually referring to this>m_Len

Should be:
Volume() function during execution, it's actually referring to this->m_Len
07/17/08
474 Error in Code
In Ex8_09.cpp

The problem is with the listnames function. In the book it appears as this:

void listnames(string names[], string ages[], size_t count)
{
size_t i = 0;
cout << endl << "The names you entered are: " << endl;
while(i<count && !names[i].empty())
cout << names[i] + " aged " + ages[i++] + '.' << endl;
}

The suggested correction that works is the following:

void listnames(string names[], string ages[], size_t count)
{
size_t i = 0;
cout << endl << "The names you entered are: " << endl;
while(i<count && !names[i].empty()){
cout << names[i] + " aged " + ages[i] + '.' << endl;
i++;
}
}
06/17/2008
502 Error in Code
The output for Ex8_13 on P502 should be:

275 feet 9 inches

14 feet 6 inches can be cut into 5 pieces 2 feet 6 inches long with 2 feet 0 inches left over.

1 feet 11 inches

2 feet 1 inches

2 feet 1 inches

02/25/09
9 551 Error in Code
The CStack class on page 551 should have the following constructor added to the public section of the class:

CStack():pTop(0){}

The loop in main() for Ex9_13.cpp on page 552 should retrieve items from the stack. The loop could be written:

CBox* pTemp(0);
while(pTemp = pStack->Pop())br> pTemp->ShowVolume();

It is good practice to delete all objects created on the stack, so there should be the following statement before the return in main():

delete pStack;

All objects created on the heap will of course be deleted on execution of the return in any event.
6/26/09
560 Error in Text
"first you create an array of handles to strings"

should be:

"first you create an array of handles to boxes"
07/06/2008
10 603 Error in Text
In chapter 10: The Standard Template Library,

in the "Container Adapters" section,

in the "<stack>" definition,

The first part of the last sentence should be:

A stack is a LAST-in first out ...
02/06/0
620 Error in Code Download
The code download for page 620 is different from what it in the book and is in error. In the Person.h file the line:

Person& operator=(const Person& p)const

Should be:

Person& operator=(const Person& p)



and the line:

bool operator<(const Person& p)

Should be:

bool operator<(const Person& p) const
03/10/09
665 Error in Code
The last line of the code snippet currently reads:
numbers.pushback(*numbersIn++);

Instead of "numbersIn" it should read "numbersInput."
05/23/2012
666 Error in Code
The last line of the code snippet at the top of the page currently reads:
accumulate(intvecRead, endStream, 0) >> endl;

'intvecRead' should read 'numbersInput'
'endStream' should be 'numbersEnd'

This has been corrected for the 2010 edition of this book.
05/23/2012
731 Error in Code
Default constructor (Name::Name) allocates a one-byte array so that the destructor can safely delete[] it.

However this is unnecessary provided the default constructor initialises the array members to 0. This is because the delete[] operator will do nothing if the pointer is null (0).
11/22/2010
761 Error in Figure
Figure 12-3 shows the method name

GetMessages()

but it should be

GetMessage()
01/03/10
13 789 Error in Figure 13-7
Figure 13-7 references an SDI application which does not need a child frame. Please see the downloads for this chapter to download the corrected figure.
07/21/08
817 Typo
just below the subtitle "Creating Menu Message Functions":
Highlight the CSketchDoc Class

should be:

Highlight the CSketcherDoc Class
10/03/08
827 Error in Text
This page says "...If you click the new button at the right end of the row as indicated, you?ll be able to draw this button."

This page should indicate a new button at the right end of a row.
5/15/2011
836 Error in Text
at the top left of the control

Should be:
at the top right of the control
10/03/08
840 Error in Text
When you select the Messages button

Should be

When you select the Events button
03/12/09
852 Typo in Text
In the section "The CDC Class," paragraph 3, the second line:

For example, you be using

Should be

For example, you will be using
6/26/09
864 Error in Text
the last mouse message:

WM_MOUSEMOVE | Message occurs when the button is moved

should be:
WM_MOUSEMOVE | Message occurs when the mouse is moved
07/23/08
878 Error in Figure 15-17
Figure 15-17, in the top half, the x-axis label:

Negative X-Axis

Should be

Positive X-Axis
2/10/09
926, 949, 954 Error in Code
In the code on page 949 for OnMouseMove, the first line after the gray text (the call to SetROP2) should not be there. It was moved to inside the if(m_pTempElement) block on page 926.
02/13/09
946 Typo in Text
In the table listing the flags for which button the pop-up tracks (just above the middle of the page), the flags are listed as TPM_LEFTMOUSEBUTTON and TPM_RIGHTMOUSEBUTTON.

They should be

TPM_LEFTBUTTON and TPM_RIGHTBUTTON.
02/13/09
954 Typo in Text
The first line after the code at the top of the page:

...to the CElements.cpp file...

Should be

...to the Elements.cpp file...
02/13/09
968 Missing Code
the Curve class Draw() function is missing some required things in order to draw a curve correctly. Only the book is missing the code. The book reads:

virtual void Draw(Graphics^ g) override
{
Point previous = Point(0, 0);
for each(Point p in points)
{
g->DrawLine(pen, previous, p);
previous = p;
}
}

this code works, but the curve is drawn starting off screen because the code to translate the coordinates is missing. The book should read:

virtual void Draw(Graphics^ g) override
{
g->TranslateTransform(safe_cast(position.X), safe_cast<float>(position.Y));
Point previous = Point(0, 0);
for each(Point p in points)
{
g->DrawLine(pen, previous, p);
previous = p;
}
g->ResetTransform();
}
07/23/08
1037 Error in Book Code
The downloadable code and the book differ here; the book version of the The penWidthButton_Click function is incorrect.

the book code for the penWidthButton_Click function should read:

private: System::Void penWidthButton_Click(System::Object^ sender, System::EventArgs^ e)
{
if(penDialog->ShowDialog() == System::Windows::Forms::DialogResult::OK)
{
penWidthComboBox->SelectedIndex = safe_cast<int>(penDialog->PenWidth - 1.0f);
penWidthComboBox->Invalidate();
}
}
07/25/08
1063 Typos
midpage, in the second marked code snippet:
typid

should be:
typeid ()

AND

typinfo

should be:
typeinfo

AND

for RTTI to work correctly:
typeid(m_pSelected)

should be:
typeid(*m_pSelected)
09/07/08
See More
Back to Top