A Division of Microsoft Corporation
One Microsoft Way
Redmond, Washington 98052-6399
Copyright 2003 by Microsoft Corporation
All rights reserved. No part of the contents of this book may be reproduced or transmitted in any form or by any means without the written permission of the publisher.
Library of Congress Cataloging-in-Publication Data
Microsoft Visual C++ .NET Step by Step: Version 2003 / Julian Templeman,
1. C++ (Computer program language) 2. Microsoft Visual C++.
3. Microsoft .NET. I. Olsen, Andy. II. Title.
Printed and bound in the United States of America.
1 2 3 4 5 6 7 8 9 QWT 8 7 6 5 4 3
Distributed in Canada by H.B. Fenn and Company Ltd.
A CIP catalogue record for this book is available from the British Library.
Microsoft Press books are available through booksellers and distributors worldwide. For further information about international editions, contact your local Microsoft Corporation office or contact Microsoft Press International directly at fax (425) 936-7329. Visit our Web site at www.microsoft.com/mspress. Send comments to: firstname.lastname@example.org.
ActiveX, IntelliSense, JScript, Microsoft, Microsoft Press, MSDN, MS-DOS, Visual Basic, Visual C++, Visual C#, Visual Studio, Windows, Windows NT, and Win32 are either registered trademarks or trademarks of Microsoft Corporation in the United States and/or other countries. Other product and company names mentioned herein may be the trademarks of their respective owners.
The example companies, organizations, products, domain names, e-mail addresses, logos, people, places, and events depicted herein are fictitious. No association with any real company, organization, product, domain name, e-mail address, logo, person, place, or event is intended or should be inferred.
Acquisitions Editor: Robin Van Steenburgh
Project Editor: Lynn Finnel
Technical Editor: Eric Dettinger
Body Part No. X09-45386
Julian Templeman first touched fingers to keypunch in 1972, punching Fortran code onto cards at college in London. Soon after, he moved on to Macro-11 programming on PDP-11s. This qualifies him as a “real programmer,” and until recently, he had a PDP-11 in his garage to remind him of better times. Since then, he’s programmed systems of all types and sizes, from single-chip computers for instrumentation to Cray and CDC supercomputers. In the course of these endeavors, he has (he is confident to assert) forgotten more programming languages than most of the readers of this book will ever learn: Snobol, Spitbol, Babbage, Forth, Trac, flavors of Lisp, flavors of Basic (the A$ sort), several dialects of JCL (//DD SYSIN * and all that jazz), Teco, Macro11, Z80 assembler, various other assemblers, WatFor, WatFiv, Icon—the list is, if not endless, then at least reasonably long. Of course, being a “real programmer,” he has never programmed in Cobol, RPG, or any other of those languages beloved by suits and bean-counters, or done anything serious involving SQL.
Julian now runs a consulting and training company in London, specializing in COM, Java, and now Microsoft .NET. He also writes computer books.
Andy Olsen is a freelance consultant engaged in training, consulting, and development services in C++, C#, and related .NET Framework technologies. Andy has been developing Microsoft applications for more than 15 years and has been using C++ since the late 1980s. He is a keen football and rugby supporter and also enjoys running and skiing, but not all at the same time. Andy now lives by the sea in Swansea, South Wales.
Tyrone Howe (Chapter 1)
Tyrone Howe received a degree in computational science from the University of Hull. He has worked as a software engineer for GEC Avionics and as a project manager for Dover Harbour Board. In 1994, he started his own company, Computerco, which specializes in software development, training, and consulting. In his spare time, Tyrone writes music and flies microlight aircraft.
Mike Hudson (Chapters 2 and 3)
Mike Hudson has been programming computers professionally for more than 15 years. Having made the transition from Z80 assembler and the AI languages—from LISP and Prolog to C++ via C—he has spent the past 10 years developing systems in C++. Mike lives in a small village in Cornwall, England.
A ladder is a portable piece of equipment with rungs attached to sides made of metal, wood, or rope, used for climbing up or down. A stepladder is a folding ladder that has flat broad steps and a hinged supporting frame. Remember: Do not stand on the top two rungs of any ladder, and do not try to “walk” a ladder by rocking it. Climb down the ladder, and then move it.
At Microsoft Press, we use tools to illustrate our books for software developers and IT professionals. Tools very simply and powerfully symbolize human inventiveness. They’re a metaphor for people extending their capabilities, precision, and reach. From simple calipers and pliers to digital micrometers and lasers, these stylized illustrations give each book a visual identity, and a personality to the series. With tools and knowledge, there’s no limit to creativity and innovation. Our tagline says it all: the tools you need to put technology to work.
The manuscript for this book was prepared and galleyed using Microsoft Word. Pages were composed by Microsoft Press using Adobe FrameMaker+SGML for Windows, with text in Garamond and display type in Helvetica Condensed. Composed pages were delivered to the printer as electronic prepress files.
Cover Designer: Methodologie, Inc.
Interior Graphic Designer: James D. Kramer
Principal Compositor: Gina Cassill
Interior Artist: Joel Panchot
Principal Copy Editor: Holly Viola
Principal Proofreaders: nSight, Inc.
Indexer: Seth Maislin