INTRODUCTION

Welcome to Ivor Horton’s Beginning Visual C++ 2013. With this book, you can become an effective C++ programmer using Microsoft’s latest application-development system, Visual Studio Professional 2013. I aim to teach you the C++ programming language, and then how to apply C++ in the development of your own Windows applications. Along the way, you will also learn about many of the exciting new capabilities introduced by this latest version of Visual C++.

Visual C++ 2013 comes with the Microsoft development environment Visual Studio Professional 2013. When I refer to Visual C++ in the rest of the book, I mean the Visual C++ 2013 capability that comes as part of Visual Studio Professional 2013. Note that the Visual Studio Express 2013 Edition does not provide sufficient facilities for this book. None of the examples in Chapters 11 through 18 can be created with Visual Studio Express 2013.

WHO THIS BOOK IS FOR

This book is for anyone who wants to learn how to write C++ applications for Microsoft Windows using Visual C++. I make no assumptions about prior knowledge of any programming language, so there are no prerequisites other than some aptitude for programming and sufficient enthusiasm and commitment for learning C++. This tutorial is for you if:

  • You are a newcomer to programming and sufficiently keen to jump into the deep end with C++. To be successful, you need to have at least a rough idea of how your computer works.
  • You have a little experience of programming in some other language, such as BASIC, and you want to learn C++ and develop practical Microsoft Windows programming skills.
  • You have some experience in C or C++, but not in a Microsoft Windows context and want to extend your skills to program for the Windows environment using the latest tools and technologies.

WHAT THIS BOOK COVERS

The first part of the book teaches you the essentials of C++ programming using Visual Studio Professional 2013 through a detailed, step-by-step tutorial. You’ll learn the syntax and use of the C++ language and gain experience and confidence in applying it in a practical context through working examples. You’ll find complete code for the examples that demonstrate virtually all aspects of C++. There are also exercises that you can use to test your knowledge, with solutions available for download if you get stuck.

The language tutorial also introduces and demonstrates the use of the C++ standard library facilities you are most likely to need. You’ll add to your knowledge of the standard libraries incrementally as you progress through the C++ language. You’ll also learn about the powerful tools provided by the Standard Template Library (STL).

When you are confident in applying C++, you move on to Windows programming. You will learn how to develop Windows desktop applications using the Microsoft Foundation Classes (MFC) by creating a substantial working application of more than 2,000 lines of code. You develop the application over several chapters, utilizing a broad range of user interface capabilities provided by the MFC. You also learn the essentials of programming applications targeting tablets running Windows 8. You learn about creating an application with the Windows 8 Modern interface by incrementally developing a working example of a game.

HOW THIS BOOK IS STRUCTURED

The book is structured so that as far as possible, each chapter builds on what you have learned in previous chapters:

  • Chapter 1 introduces you to the basic concepts you need to understand for programming in C++ and the main ideas embodied in the Visual C++ development environment. It describes how you use Visual C++ to create the various kinds of applications you’ll learn about in the rest of the book.
  • Chapters 2 through 9 teach you the C++ language. You start with simple procedural program examples and progress to learning about classes and object-oriented programming.
  • Chapter 10 teaches you how you use the Standard Template Library (STL). The STL is a powerful and extensive set of tools for organizing and manipulating data in your C++ programs. The STL is application-neutral, so you can apply it in a wide range of contexts.
  • Chapter 11 discusses how Microsoft Windows desktop applications are structured and describes and demonstrates the essential elements that are present in every desktop application written for the Windows operating system. The chapter explains through elementary examples how Windows applications work, and you’ll create programs that use C++ with the Windows API and with the MFC.
  • Chapters 12 through 17 teach you Windows desktop application programming. You learn to write Windows applications using the MFC for building a GUI. You’ll be creating and using common controls to build the graphical user interface for your application, and you’ll learn how to handle the events that result from user interactions with your program. In addition to the techniques you learn for building a GUI, the application you develop will show you how to handle printing and how your application can work with files.
  • Chapter 18 introduces the fundamental ideas involved in writing applications for Windows 8. You’ll develop a fully working application that uses the Windows 8 Modern user interface.

All chapters include working examples that demonstrate the programming techniques discussed. Every chapter concludes with a summary of the key points that were covered, and most chapters include a set of exercises at the end that you can attempt, to apply what you have learned. Solutions to all the exercises, and all the code from the examples in the book are available for download from the publisher’s website.

WHAT YOU NEED TO USE THIS BOOK

There are several versions of Visual Studio 2013, and they each have a different range of capabilities. This book assumes you have the Visual Studio Professional 2013 Edition (or a superior edition) installed. To put it another way, any of the paid versions of Visual Studio 2013 are okay. There are lower cost student versions of these available if you are in full-time education. None of the free Express editions will suffice.

All the examples in Chapters 1 through 17 will work if you have Visual Studio installed with Windows 7 or Windows 8. To work with Chapter 18, your version of Visual Studio must be installed in a Windows 8 environment.

The examples in Chapters 2 through 10 can be created and executed with the Visual Studio Express 2013 for Windows Desktop, but none of the examples in Chapters 11 through 18 can.

CONVENTIONS

To help you get the most from the text and keep track of what’s happening, we’ve used a number of conventions throughout the book.

As for styles in the text:

  • We highlight new terms and important words when we introduce them.
  • We show keyboard strokes like this: Ctrl+A.
  • We show filenames, URLs, and code within the text like so: persistence.properties.
  • We present code in two different ways:
We use a monofont type with no highlighting for most code examples.
We use bold highlighting to emphasize code that is of particular importance in the present context.

SOURCE CODE

You should type in the code for all the examples yourself; this greatly helps memory and the learning process. However, you can download all the source code files for examples in the book, so if you can’t work out why your code doesn’t work, you’ll have some available that does. The code downloads for the examples are located at www.wrox.com/go/beginningvisualc on the Download Code tab.

Once you download the code, just decompress it with your favorite compression tool. Alternately, you can go to the main Wrox code download page at www.wrox.com/dynamic/books/download.aspx to see the code available for this book and all other Wrox books.

EXERCISES

Many of the chapters have a set of exercises for you to test your knowledge. I encourage you to try all of these. If you get stuck you can download solutions to all of these exercises from www.wrox.com/go/beginningvisualc.

ERRATA

We make every effort to ensure that there are no errors in the text or in the code. However, no one is perfect, and mistakes do occur. If you find an error in one of our books, like a spelling mistake or faulty piece of code, we would be very grateful for your feedback. By sending in errata, you may save another reader hours of frustration, and at the same time, you will be helping us provide even higher quality information.

To find the errata page for this book, go to http://www.wrox.com and locate the title using the Search box or one of the title lists. Then, on the book’s detail page, click the Book Errata link. On this page, you can view all errata that has been submitted for this book and posted by Wrox editors. A complete book list, including links to each book’s errata, is also available at www.wrox.com/misc-pages/booklist.shtml.

If you don’t spot “your” error on the Book Errata page, go to www.wrox.com/contact/techsupport.shtml and complete the form there to send us the error you have found. We’ll check the information and, if appropriate, post a message to the book’s errata page and fix the problem in subsequent editions of the book.

P2P.WROX.COM

For author and peer discussion, join the P2P forums at p2p.wrox.com. The forums are a web-based system for you to post messages relating to Wrox books and related technologies and interact with other readers and technology users. The forums offer a subscription feature to e-mail you topics of interest of your choosing when new posts are made to the forums. Wrox authors, editors, other industry experts, and your fellow readers are present on these forums.

At http://p2p.wrox.com, you will find a number of different forums that will help you, not only as you read this book, but also as you develop your own applications. To join the forums, just follow these steps:

  1. Go to p2p.wrox.com and click the Register link.
  2. Read the terms of use and click Agree.
  3. Complete the required information to join, as well as any optional information you wish to provide, and click Submit.
  4. You will receive an e-mail with information describing how to verify your account and complete the joining process.

Once you join, you can post new messages and respond to messages other users post. You can read messages at any time on the web. If you would like to have new messages from a particular forum e-mailed to you, click the Subscribe to this Forum icon by the forum name in the forum listing.

For more information about how to use the Wrox P2P, be sure to read the P2P FAQs for answers to questions about how the forum software works, as well as many common questions specific to P2P and Wrox books. To read the FAQs, click the FAQ link on any P2P page.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.15.189.250