Siêu thị PDFTải ngay đi em, trời tối mất

Thư viện tri thức trực tuyến

Kho tài liệu với 50,000+ tài liệu học thuật

© 2023 Siêu thị PDF - Kho tài liệu học thuật hàng đầu Việt Nam

Beginning Visual C++ 2010
PREMIUM
Số trang
1276
Kích thước
33.5 MB
Định dạng
PDF
Lượt xem
1863

Beginning Visual C++ 2010

Nội dung xem thử

Mô tả chi tiết

Join the discussion @ p2p.wrox.com Wrox Programmer to Programmer™

Beginning

Ivor Horton’s

Ivor Horton

Visual C++®

2010

www.it-ebooks.info

Get more out of

wrox.com

Programmer to Programmer™

Interact

Take an active role online by participating in our

P2P forums @ p2p.wrox.com

Wrox Online Library

Hundreds of our books are available online

through Books24x7.com

Wrox Blox

Download short informational pieces and code

to keep you up to date and out of trouble!

Join the Community

Sign up for our free monthly newsletter at

newsletter.wrox.com

Browse

Ready for more Wrox? We have books and

e-books available on .NET, SQL Server, Java,

XML, Visual Basic, C#/ C++, and much more!

Contact Us.

We always like to get feedback from our readers. Have a book idea?

Need community support? Let us know by e-mailing wrox-partnerwithus@wrox.com

www.it-ebooks.info

IVOR HORTON’S

BEGINNING VISUAL C++® 2010

INTRODUCTION . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxxiii

CHAPTER 1 Programming with Visual C++ 2010 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1

CHAPTER 2 Data, Variables, and Calculations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35

CHAPTER 3 Decisions and Loops . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121

CHAPTER 4 Arrays, Strings, and Pointers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 167

CHAPTER 5 Introducing Structure into Your Programs . . . . . . . . . . . . . . . . . . . . . . . . 251

CHAPTER 6 More about Program Structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 295

CHAPTER 7 Defi ning Your Own Data Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 353

CHAPTER 8 More on Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 435

CHAPTER 9 Class Inheritance and Virtual Functions . . . . . . . . . . . . . . . . . . . . . . . . . 549

CHAPTER 10 The Standard Template Library . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 645

CHAPTER 11 Debugging Techniques . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 755

CHAPTER 12 Windows Programming Concepts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 807

CHAPTER 13 Programming for Multiple Cores . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 843

CHAPTER 14 Windows Programming with the Microsoft Foundation Classes . . . . . 875

CHAPTER 15 Working with Menus and Toolbars . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .903

CHAPTER 16 Drawing in a Window . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 945

CHAPTER 17 Creating the Document and Improving the View . . . . . . . . . . . . . . . . . 1009

CHAPTER 18 Working with Dialogs and Controls . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1059

CHAPTER 19 Storing and Printing Documents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1123

CHAPTER 20 Writing Your Own DLLs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1175

INDEX . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1193

www.it-ebooks.info

www.it-ebooks.info

IVOR HORTON’S

BEGINNING

Visual C++® 2010

www.it-ebooks.info

www.it-ebooks.info

IVOR HORTON’S

BEGINNING

Visual C++® 2010

Ivor Horton

www.it-ebooks.info

Ivor Horton’s Beginning Visual C++® 2010

Published by

Wiley Publishing, Inc.

10475 Crosspoint Boulevard

Indianapolis, IN 46256

www.wiley.com

Copyright © 2010 by Ivor Horton

Published by Wiley Publishing, Inc., Indianapolis, Indiana

Published simultaneously in Canada

ISBN: 978-0-470-50088-0

Manufactured in the United States of America

10 9 8 7 6 5 4 3 2 1

No part of this publication may be reproduced, stored in a retrieval system or transmitted in any form or by any means,

electronic, mechanical, photocopying, recording, scanning or otherwise, except as permitted under Sections 107 or 108

of the 1976 United States Copyright Act, without either the prior written permission of the Publisher, or authorization

through payment of the appropriate per-copy fee to the Copyright Clearance Center, 222 Rosewood Drive, Danvers,

MA 01923, (978) 750-8400, fax (978) 646-8600. Requests to the Publisher for permission should be addressed to the

Permissions Department, John Wiley & Sons, Inc., 111 River Street, Hoboken, NJ 07030, (201) 748-6011, fax (201)

748-6008, or online at http://www.wiley.com/go/permissions.

Limit of Liability/Disclaimer of Warranty: The publisher and the author make no representations or warranties with

respect to the accuracy or completeness of the contents of this work and specifi cally disclaim all warranties, including

without limitation warranties of fi tness for a particular purpose. No warranty may be created or extended by sales or

promotional materials. The advice and strategies contained herein may not be suitable for every situation. This work

is sold with the understanding that the publisher is not engaged in rendering legal, accounting, or other professional

services. If professional assistance is required, the services of a competent professional person should be sought. Neither

the publisher nor the author shall be liable for damages arising herefrom. The fact that an organization or Web site is

referred to in this work as a citation and/or a potential source of further information does not mean that the author or the

publisher endorses the information the organization or Web site may provide or recommendations it may make. Further,

readers should be aware that Internet Web sites listed in this work may have changed or disappeared between when this

work was written and when it is read.

For general information on our other products and services please contact our Customer Care Department within the

United States at (877) 762-2974, outside the United States at (317) 572-3993 or fax (317) 572-4002.

Wiley also publishes its books in a variety of electronic formats. Some content that appears in print may not be available

in electronic books.

Library of Congress Control Number: 2010921242

Trademarks: Wiley, the Wiley logo, Wrox, the Wrox logo, Wrox Programmer to Programmer, and related trade dress

are trademarks or registered trademarks of John Wiley & Sons, Inc. and/or its affi liates, in the United States and

other countries, and may not be used without written permission. Visual C++ is a registered trademark of Microsoft

Corporation in the United States and/or other countries. All other trademarks are the property of their respective owners.

Wiley Publishing, Inc., is not associated with any product or vendor mentioned in this book.

www.it-ebooks.info

This book is for Edward Gilbey, who arrived in

September 2009 and has been a joy to have around ever since.

www.it-ebooks.info

www.it-ebooks.info

ABOUT THE AUTHOR

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 usually being 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 and 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 manufacturing

operations in a variety of industries. He has considerable experience in developing occasionally

useful applications in a wide variety of programming languages, and in teaching scientists and

engineers primarily to do likewise. He has been writing books on programming for more than 15

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

fi shing, traveling, and enjoying life in general.

www.it-ebooks.info

www.it-ebooks.info

ABOUT THE TECHNICAL EDITOR

MARC GREGOIRE is a software engineer from Belgium. He graduated from the Catholic University

Leuven, Belgium, with a degree in “Burgerlijk ingenieur in de computer wetenschappen” (equivalent

to Master of Science in Engineering in Computer Science). After that, he received the cum laude

degree of Master in Artifi cial Intelligence at the same university, started working for a big software

consultancy company (Ordina: http://www.ordina.be). His main expertise is C/C++, specifi cally

Microsoft VC++ and the MFC framework. Next to C/C++, Marc also likes C# and uses PHP

for creating web pages. In addition to his main interest for Windows development, he also has

experience in developing C++ programs running 24x7 on Linux platforms, and in developing critical

2G and 3G software running on Solaris for big telecom operators.

In April of the years 2007, 2008, and 2009 he received the Microsoft MVP (Most Valuable

Professional) award for his Visual C++ expertise.

Marc is an active member on the CodeGuru forum (as Marc G) and also wrote some articles

and FAQ entries for CodeGuru. He creates freeware and shareware programs that are distributed

through his website at www.nuonsoft.com and maintains a blog on www.nuonsoft.com/blog/.

www.it-ebooks.info

www.it-ebooks.info

CREDITS

EXECUTIVE EDITOR

Robert Elliott

PROJECT EDITOR

John Sleeva

TECHNICAL EDITOR

Marc Gregoire

PRODUCTION EDITOR

Eric Charbonneau

COPY EDITOR

Sadie Kleinman

EDITORIAL DIRECTOR

Robyn B. Siesky

EDITORIAL MANAGER

Mary Beth Wakefi eld

MARKETING MANAGER

Ashley Zurcher

PRODUCTION MANAGER

Tim Tate

VICE PRESIDENT AND EXECUTIVE GROUP

PUBLISHER

Richard Swadley

VICE PRESIDENT AND EXECUTIVE PUBLISHER

Barry Pruett

ASSOCIATE PUBLISHER

Jim Minatel

PROJECT COORDINATOR, COVER

Lynsey Stanford

PROOFREADERS

Maraya Cornell and Paul Sagan, Word One

INDEXER

Johnna VanHoose Dinse

COVER DESIGNER

Michael E. Trent

COVER IMAGE

©istockphoto

www.it-ebooks.info

Tải ngay đi em, còn do dự, trời tối mất!