Next chapterContents


Teach Yourself Visual C++ 6 in 21 Days


About the Authors

DAVIS CHAPMAN first began programming computers while working on his master's degree in music composition. Writing applications for computer music, he discovered that he enjoyed designing and developing computer software. It wasn't long before he came to the realization that he stood a much better chance of eating if he stuck with his new-found skill and demoted his hard-earned status as a "starving artist" to a part-time hobby. Since that time, Davis has focused on the art of software design and development, with a strong emphasis on the practical application of client/server technology. Davis is the lead author of Web Development with Visual Basic 5 and Building Internet Applications with Delphi 2. Davis is also a contributing author of Special Edition Using Active Server Pages and Running a Perfect Web Site, Second Edition. He has been a consultant working and living in Dallas, Texas, for the past eight years, and he can be reached at davischa@onramp.net.

Contributing Author

JON BATES has worked on a whole range of commercial, industrial, and military software development projects worldwide over the past fifteen years. He is currently working as a self-employed software design consultant and contract software developer, specializing in Visual C++ application development for Windows NT/95/98.

Jon began his career writing computer games for popular microcomputers and has since worked with a number of operating systems, such as CPM, DOS, TRIPOS, UNIX, and Windows, and a number of Assembly, third-generation, and object-oriented languages.

He has written system and application software as diverse as device drivers, email, production modeling, motion video, image analysis, network and telecommunications, data capture, control systems, estimating and costing, and visualization software. He has also written a number of technical articles for computing journals on a range of topics.

Jon lives with his wife, Ruth, and dog, Chaos, in the middle of cool Britannia. When not playing with computers, he likes to sleep and dream of fractals.

You can reach Jon at jon@chaos1.demon.co.uk and visit his Web site at www.chaos1.demon.co.uk.

Dedication

To Dore, and the rest of my family, for being very patient with me while I was busy writing yet another book.

Acknowledgments

There are numerous people without whom this book might never have been written. Among those who deserve credit is Kelly Marshall, for enabling me to take on this project and for sticking with me even though I know I made her life stressful at times. Credit needs to go to the entire editing team at Macmillan. I've seen what some of the material you have to work with looks like when it comes in from the authors, and I don't want to trade jobs with any of you. I'd also like to thank my family for continuing to allow me to put in the work required to produce this book--and for not disowning me in the process.

Tell Us What You Think!

As the reader of this book, you are our most important critic and commentator. We value your opinion and want to know what we're doing right, what we could do better, what areas you'd like to see us publish in, and any other words of wisdom you're willing to pass our way.

As the executive editor for the Programming team at Macmillan Computer Publishing, I welcome your comments. You can fax, email, or write me directly to let me know what you did or didn't like about this book--as well as what we can do to make our books stronger.

Please note that I cannot help you with technical problems related to the topic of this book, and that due to the high volume of mail I receive, I might not be able to reply to every message.

When you write, please be sure to include this book's title and author as well as your name and phone or fax number. I will carefully review your comments and share them with the author and editors who worked on the book.

Fax: 317-817-7070
Email: adv_prog@mcp.com
Mail: Executive Editor

Programming

Macmillan Computer Publishing

201 West 103rd Street

Indianapolis, IN 46290 USA

Introduction

Welcome to Visual C++. Over the next 21 days, you will learn how to use the features that Microsoft has built into its C++ development environment to enable you to create very advanced applications for the Windows and NT platforms. When Microsoft's developers first came up with the idea behind Visual C++, they decided to take their world-class C++ compiler and create a development environment and set of tools that would enable developers to create Windows applications with a level of ease and speed that was unheard of among C++ development environments. Since that first version, Microsoft has continued to improve the tools that are a part of Visual C++ to make it even easier to create Windows applications. As Microsoft has introduced new technologies into the Windows platforms, it has also introduced tools into the Visual C++ suite to make it easy to integrate these new technologies into your applications.

If you are new to C++, don't worry. I've tried to make it easy for you to learn the C++ programming language while also learning how to build applications using the Visual C++ tools. Just in case you find yourself having trouble understanding some aspect of C++, I've included a brief overview of the programming language in Appendix A, "C++ Review."

If you've looked at previous versions of this book, you might notice that I've completely rewritten the entire book. Our goal with this new version is not just to introduce you to and guide you through the various tools and resources that you will use to build applications with Visual C++; I've also tried to include a great deal more detail about the various options that are available to you with each of the features that are covered. This way, you'll be able to get a lot of use out of this book long after the initial 21 days.

How This Book Is Organized

This book is organized in weeks, with each set of seven days set off into a part unto itself. However, even though the book is organized in weeks, the topics are not neces-sarily organized that way.

For the first week, you'll be covering the basics of building applications with Visual C++. You'll learn how to use designers to design your application windows. You'll learn how to use various controls available to you as a Windows application developer. You'll also learn a lot about the Visual C++ development environment and the tools that it makes available to you.

By the time you begin the second week, you'll be doing more and more programming, as the topics become more involved. You'll still be using the Visual C++ tools to construct your applications, but the programming code will be getting a little more involved. You'll also start learning about more advanced topics, such as displaying graphics and creating SDI and MDI applications. Toward the end of the second week, you'll begin to work with databases. This topic spills over into the third and final week.

In the third week, you'll learn how to create your own modules, DLLs, and ActiveX controls. You'll also learn how to build multitasking applications, which perform multiple tasks at a time. Finally, you'll learn how to integrate Microsoft Internet Explorer, and the ActiveX controls it provides, into your applications so that you can extend your applications over the Internet.

After you finish the third week, you'll be ready to tackle the world of Windows programming with Visual C++. You'll have the skills and know-how required to build most Windows applications available today.

Conventions Used in This Book

While you are reading this book, you will probably notice a couple conventions that have been used to make it easier for you to learn the topic being discussed.

All the source code in this book is provided in a monospaced font, as shown in Listing 0.1. This includes all the source code from the applications that you will be building and illustrations of how various functions can be used. Whenever you are adding new code, or changing code in a function with other code already there, the line numbers of the code that you add or change will be pointed out in the text.

LISTING 0.1. SOME SAMPLE CODE.

1: void main()
2: {
3:     // if you are adding or changing code in an existing
4:     // code snippet, I will point out the line numbers in the text.
5: }

If a topic needs special attention, it will be set apart from the rest of the text by one of several special markers:


NOTE: Notes offer a deeper explanation of a topic or explain interesting or important points.


TIP: Tips are pieces of information that can make things easier.


CAUTION: Cautions warn you about traps that you will want to avoid.

At the end of each day, you'll find a short quiz and one or two exercises to help make sure that you learned the topic you were studying. Don't worry--just in case you need the answers to the quizzes and some guidance when building the exercises, the solutions are provided in Appendix B, "Answers."

Enough said! You didn't buy this book to read about this book. You bought this book to learn how to use Visual C++ to build Windows applications. So go ahead and flip the page and get started programming...


Next chapterContents

© Copyright, Macmillan Computer Publishing. All rights reserved.

Hosted by uCoz