1. Trang chủ
  2. » Công Nghệ Thông Tin

Programming with micros

710 47 0

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 710
Dung lượng 4,22 MB

Nội dung

This document is created with a trial version of CHM2PDF Pilot http://www.colorpilot.com Programming with Microsoft Visual C++ NET, Sixth Edition ISBN:0735615497 by George Shepherd and David Kruglinski Microsoft Press © 2003 (1038 pages) The in-depth reference that covers both classic, core Windows competencies and modern NET programming Table of Contents Programming with Microsoft Visual C++ NET, Sixth Edition Introduction Part I - Windows, Visual C++ NET, and Application Framework Fundamentals Chapter - Windows and Visual C++ NET Chapter - The Microsoft Foundation Class Library Application Framework Part II - MFC Essentials Chapter Chapter Chapter Chapter Chapter Chapter Chapter Chapter 10 Chapter 11 - Getting Started with the MFC Application Wizard Visual C++ NET Wizards Windows Message Mapping Classic GDI Functions, Fonts, and Bitmaps Dialog Boxes Common Controls Using ActiveX Controls Win32 Core Memory Management Windows Message Processing and Multi-Threaded Programming Part III - MFC's Document-View Architecture Chapter 12 - Menus, Keyboard Accelerators, the Rich Edit Control, and Property Sheets Chapter 13 - Toolbars and Status Bars Chapter 14 - A Reusable Frame Window Base Class Chapter 15 - Separating the Document from Its View Chapter 16 - Reading and Writing Documents Chapter 17 - Printing and Print Preview Chapter 18 - Splitter Windows and Multiple Views Chapter 19 - Context-Sensitive Help Chapter 20 - Dynamic-Link Libraries Chapter 21 - MFC Programs Without Document or View Classes Part IV - COM, Automation, ActiveX, and OLE Chapter 22 Chapter 23 Chapter 24 Chapter 25 Chapter 26 Chapter 27 - The Component Object Model Automation Uniform Data Transfer: Clipboard Transfer and OLE Drag and Drop Introducing the Active Template Library ATL and ActiveX Controls The OLE DB Templates Part V - Programming for the Internet Chapter 28 - Internet Essentials Chapter 29 - Introducing Dynamic HTML Chapter 30 - ATL Server Part VI - NET and Beyond Chapter 31 Chapter 32 Chapter 33 Chapter 34 Chapter 35 Appendix A - Microsoft NET Managed C++ Programming Windows Forms Using Managed C++ Programming ASP.NET Using Managed C++ Programming ADO.NET Using Managed C++ Message Map Functions in the MFC Library This document is created with a trial version of CHM2PDF Pilot http://www.colorpilot.com Appendix A - Message Map Functions in the MFC Library Appendix B - MFC Library Runtime Class Identification and Dynamic Object Creation Index List of Figures List of Tables List of Listings List of Sidebars CD Content This document is created with a trial version of CHM2PDF Pilot http://www.colorpilot.com Back Cover Learn how to write solid Visual C++ NET code today with this comprehensive reference—the latest edition of the industry’s most trusted text It’s the complete programming guide for intermediate and advanced developers who want to create NET applications with Visual C++ and the Microsoft NET Framework Focusing on core programming techniques, instructions, and solutions, this book shows you what’s new in Visual C++ NET and walks you through the development life cycle with this powerful language Get indepth coverage of the language’s syntax, tools, and APIs—along with expert advice and timesaving techniques Take advantage of complete, task-based instruction plus your Microsoft Windows and C++ programming skills to produce a new generation of killer Windows and NET-based applications Topics Covered Include: Fundamentals: Windows and Visual C++, MFC essentials and the MFC application wizard; Visual C++ NET wizards; Windows message mapping; classic GDI functions, fonts, and bitmaps; dialog boxes; common controls and Microsoft ActiveX controls; Microsoft Win32 core memory management; Windows message processing and multithreaded programming MFC document-view architecture: Menus, keyboard accelerators, the Rich Edit control, and property sheets; toolbars and status bars; a reusable frame Windows base class; separating the document from its view; reading and writing document—SDI and MDI applications; printing and print preview; splitter windows and multiple views; context-sensitive Help; dynamic link libraries, MFC programs without document or view classes COM, automation, ActiveX and OLE: Automation and IDispatch, data transfer with Clipboard and OLE drag-and-drop, the Active Template Library, ActiveX Controls, OLEDB templates Programming for the Internet: TCP/IP, Winsock, and WinINet; dynamic HTML; ATL Server .NET and beyond: The NET platform; NET interoperability with managed C++; Windows Forms, GDI+, and NET Web services with C++; Microsoft ADO.NET About the Authors Besides writing NET development tools for Suncfusion, George Shepherd teaches courses for DevelopMentor For Microsoft Press, he has coauthored several editions of Programming with Microsoft Visual C++ NET, plus Inside ATL He has also written books about applied NET programming and MFC internals and is a contributing editor at MSDN Magazine David Kruglinski was on the team that originally created Microsoft Visual C++ This document is created with a trial version of CHM2PDF Pilot http://www.colorpilot.com Programming with Microsoft Visual C++ NET, Sixth Edition George Shepherd with David Kruglinski PUBLISHED BY Microsoft Press A Division of Microsoft Corporation One Microsoft Way Redmond, Washington 98052-6399 Copyright © 2003 by George Shepherd 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 Shepherd, George Programming with Microsoft Visual C++ NET, Sixth Edition (Core Reference) / George Shepherd p cm Includes index ISBN 0-7356-1549-7 2002 QWT 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: mspinput@microsoft.com ActiveX, FoxPro, IntelliSense, Microsoft, Microsoft Press, MSDN, MS-DOS, Visio, Visual Basic, Visual C++, Visual Studio, Win32, and Windows 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 Editors: Juliana Aldous and Danielle Bird Project Editor: Denise Bankaitis Technical Editor: Julie Xiao Body Part No X08-68165 Dedicated to Sandy Daston and Ted Shepherd Acknowledgments This part of book writing is always the best— everybody involved is nearly done with the manuscript and all that's left to is to thank everybody Because the author's name appears on the cover, it's sometimes easy to forget all the other folks involved in a project as large as this Many other folks gave their time and energy to this project, and I wish to thank you Thank you Sandy Daston and Ted Shepherd—my family, for your support while I wrote this book Thank you, Denise Bankaitis As the project editor, you kept me going by reminding me of the importance of this project (a key C++ reference for NET) and by coordinating the efforts of the rest of the team, which includes Julie Xiao, Ina Chang, Danielle Bird, Juliana Aldous, Joel Panchot, Carl Diltz, and Gina Cassill Thank you, Julie Xiao, for keeping the manuscript accurate Thank you, Ina Chang, for making my sentences readable Thank you, Danielle Bird and Juliana Aldous As acquisition editors, you got this project rolling and kept it on track Thank you, Joel Panchot, for making sure the art in this book looks good Thank you, Carl Diltz and Gina Cassill, for composing the manuscript and making it look great I would also like to thank the folks at DevelopMentor, for providing a wonderful environment and community for thinking and learning about modern computing You guys are wonderful George Shepherd When George Shepherd isn't writing NET components for Syncfusion ( http://www.syncfusion.com), he teaches short courses with DevelopMentor ( http://www.develop.com) George is a contributing editor for MSDN magazine, and the coauthor of several other books on working with Microsoft technologies George now prefers to play his Hamer Artist between compiles (although NETís new JIT compiling doesnít leave as much time for that) Drill Bit The year was 1914, and the electric motor was still newfangled Along came two bright young fellows, S Duncan Black and Alonzo G Decker, who saw its possibilities They hooked one of the new motors up to a drill bit—a circular piece of metal with a This document is created with a trial version of CHM2PDF Pilot http://www.colorpilot.com Alonzo G Decker, who saw its possibilities They hooked one of the new motors up to a drill bit—a circular piece of metal with a chisel edge and cutting lips— and the world's first electric drill was born It had a pistol grip and a trigger switch, and it made boring holes a snap, but it didn't really catch on until 20 years later when, in 1946, Black and Decker designed a model for consumers, and the tool took off As usual, necessity was the mother of invention and the father of a highly successful company— a bit of wisdom you can drill home time and time again.[*] 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 tag line 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 Proofreader: Ina Chang Indexer: Julie Kawabata [*]From The Great Tool Emporium by David X Manners (published by E.P Dutton/Times Mirror Magazines, Inc., 1979) This document is created with a trial version of CHM2PDF Pilot http://www.colorpilot.com Introduction The release of the Microsoft Visual Studio NET (and Visual C++ NET in particular) has underscored Microsoft's increasing focus on Internet technologies, which are at the heart of the Microsoft NET architecture In addition to supporting the NET initiative, Visual C++ NET keeps all the productivity-boosting features you're familiar with, such as Edit And Continue, IntelliSense, AutoComplete, and code tips Visual C++ NET also includes many new features such as managed code extensions for NET programming, support for attributed code, and a more consistent development environment These features take Visual C++ NET to a new level This book will get you up to speed on the latest technologies introduced into Visual C++ .NET, MFC, and ATL The technology churn we face these days is pretty impressive We went from no computers on our office desktops to nearly everyone having a computer running MS-DOS in the 1980s to nearly everyone running Microsoft Windows by the mid-1990s The technology wheel is about to turn again In the late 1990s, everyone was developing Web sites by hand using tools such as raw Hypertext Markup Language (HTML), Common Gateway Interface (CGI), Internet Server Application Programming Interface (ISAPI) DLLs, Java, and Active Server Pages (ASP) In July 2000, Microsoft announced to the world that it would change all that by betting the company on a new technology direction named NET The current thrust of Microsoft is indeed NET For a number of years, it's been possible to build a Web site by setting up a server somewhere, getting an IP address, and putting up some content Anyone with the URL of your site can surf there and check it out Commercial enterprises have been taking advantage of the Web by posting information that's useful to customers The Web has also become an invaluable research tool and efficient news broadcast medium The computing world of the near future will involve the Web heavily However, rather than just having human eyeballs look at Web sites, computers themselves will look at Web sites That is, Web sites will be programmable through Web services The NET vision also pushes the responsibility of providing a rich user interface out to the server With so much emphasis on Web services and server-based user interfaces, it might seem that standalone applications and clientside user interface scenarios—normally the realm of tools such as the Microsoft Foundation Class Library (MFC)—will be left in the dust But the need for rich client-side user interfaces is unlikely to go away Many thought that the advent of the PC and distribution technologies would spell the end of centralized processing on mainframes and minicomputers It turns out that PCs and distribution technologies only added to the available computing arsenal The NET vision of Web services and rich user interfaces provided by the server only adds to the options available to software developers Rich client-side user interfaces will continue to be viable for many types of applications, running alongside other applications that use other kinds of user interfaces (such as server-generated user interfaces) MFC is a mature and well-understood technology that's accompanied by a host of third-party extensions For at least a little while longer, MFC represents the most effective way to write full-featured standalone applications A good portion of this book will focus on MFC-style development, but we'll also cover Windows Forms—the NET way to write client-side user interfaces Of course, the next question is: Where does this leave COM? COM has solved many problems related to distributed processing, but it has some serious shortcomings—mostly centered around component versioning and type information Microsoft's NET vision is based on the common language runtime The runtime takes the place of COM as the interoperability standard within NET We'll cover NET and the common language runtime in depth in Part VI of this book COM and the common language runtime represent different approaches to component architecture, but Microsoft has taken great care to ensure a seamless coexistence The interoperability path between COM and the runtime is smooth in most cases Within the NET world, you probably won't find yourself using COM as a component architecture However, you might find yourself using Active Template Library (ATL) Server, which is a high-performance means of writing Web sites I've updated the coverage of ATL and MFC in this edition of the book because you'll still find it very useful More important, I'll show you how to leverage your heritage code (sounds better than "legacy code," doesn't it?) as you move into the NET world This document is created with a trial version of CHM2PDF Pilot http://www.colorpilot.com Managed C++ vs C# The NET platform has introduced a new C++-like language named C# C# is a curly-brace-oriented language without all the headaches of C++ Much of C#'s appeal is due to the fact that it's missing some of the more problematic elements of C++ (such as raw pointer management) while maintaining the useful features (such as virtual functions) The C# compiler eventually emits managed code—the kind that runs under the common language runtime However, the entire world isn't going to switch over to C# overnight There's just too much C++ code out there to convert Also, it will take a bit of time for developers to become fully comfortable with C# In the meantime, NET has introduced extensions to C++ for producing managed code (code that runs under the common language runtime) Managed Extensions for C++ will help ease the burden of developing software for the NET platform because they allow you to quickly update existing C++ code to work with NET Getting the managed code features in C++ means sprinkling your code with various keywords In the end, C# and managed C++ boil down to the same executable code once the compilers are done with it In the NET world, you'll probably find yourself writing new components using C# while using managed C++ to add NET features to your existing code base This document is created with a trial version of CHM2PDF Pilot http://www.colorpilot.com NET vs the Java Platform In recent years, we've seen a great deal of interest in the Java programming language and platform Java became a great boon for Internet developers by providing a useful means of distributing client user interfaces (through Java applets) and by providing enterprise solutions through Java Enterprise Edition Now, NET has become the best Internet development platform available today Unlike the Java platform, which requires that you write all your code using the Java syntax, NET often lets you use multiple syntaxes to arrive at the same machine instruction set You can use C++ (the main focus of this book) and its managed extensions, Visual Basic NET, C#, and even a host of third-party NET languages to write your programs Once you develop your source code, it is compiled to intermediate language and then eventually machine code before it runs Because NET code is managed by a runtime, you get benefits such as garbage collection and better code security This document is created with a trial version of CHM2PDF Pilot http://www.colorpilot.com Who This Book Is For Visual C++ NET, with its sophisticated application framework and support for NET, is for professional programmers, and so is this book I'll assume that you're proficient in the C language—you can write an if statement without consulting the manual And I'll assume that you've been exposed to the C++ language—you've at least taken a course or read a book even if you haven't written much code You might compare learning C++ to learning French You can study French in school, but you won't be able to speak fluently unless you go to a French-speaking country and start talking to people The Visual C++ wizards save you time and improve accuracy, but programmers must understand the code that the wizards generate and, ultimately, they must understand the structure of the MFC and ATL libraries, the inner workings of the Windows operating system, and how NET works I won't assume, however, that you already know Windows and NET programming I'm sure that proficient C programmers can learn Windows the MFC way and the NET way It's more important to know C++ than it is to know the Win32 application programming interface (API) You should, however, know how to run Windows and Windows-based applications If you're already experienced with the Win32 API or with the MFC library, there's something in this book for you, too You'll learn about new features such as the Multiple Top-Level Interface (MTI) and the Visual C++ NET wizards If you haven't already figured out the Component Object Model (COM), this book presents some important theory that will get you started on understanding ActiveX controls You'll also learn about ATL Server and OLE DB templates And you'll learn about C++ programming for the Internet (including Dynamic HTML) Finally, this book includes hard-to-find coverage of the new managed C++ extensions This document is created with a trial version of CHM2PDF Pilot http://www.colorpilot.com What's Not Covered It's impossible to cover every aspect of Windows and NET programming in a single book I've excluded topics that depend on special-purpose hardware and software, such as MAPI, TAPI, and communications port access I'll cover using ActiveX controls in an application and writing ActiveX controls using ATL, but I'll defer the in-depth coverage to Adam Denning and his ActiveX Controls Inside Out (Microsoft Press, 1997) I'll get you started with 32-bit memory management, DLL theory, multi-threaded programming techniques, and NET programming, but you need to get the third edition of Jeffrey Richter's Programming Applications for Microsoft Windows (Microsoft Press, 1997) if you're serious about these subjects Another useful book is MFC Internals by George Shepherd and Scot Wingo (Addison-Wesley, 1996) I'll also give you a head start into the NET space, but I'll leave the hardcore runtime issues to Jeffrey Richter's Applied NET Programming (Microsoft Press, 2002) This document is created with a trial version of CHM2PDF Pilot http://www.colorpilot.com ways to run programs, 48 Windows diagnostic tools, 16 Visual C++ vs Visual C++ NET, 8–9 Visual Studio NET adding a custom wizard, 59 C++ wrapper classes for ActiveX controls, 217–20 creating modal dialog box for existing project, 136–37 creating wizards, 51–53 Managed C++ Applications template, 914 Managed C++ Class Library template, 914, 959 Managed C++ Empty Project template, 914 Managed C++ Web Service template, 914 Managed C Windows Forms Wizard, 929–32 Registers window, 248 Visual C++ NET and, 8–9, 11 VSDIR files, 52, 59 VSZ files, 52, 59 vtables, 704–5 This document is created with a trial version of CHM2PDF Pilot http://www.colorpilot.com Index W WaitForSingleObject function, 270, 271 Web applications, creating sample wizard for generating, 53–60 Web browsers ActiveX controls and, 233–37 creating, 233–37 Web clients creating with MFC WinInit classes, 844–45 role of CHttpBlockingSocket class, 837 Web Forms, 962–67 Web proxy access, WinInit and, 839 Web servers, 834–37 Web services creating client-side proxies, 979–80 managed C++, 976–78 overview, 976 Web Services Description Language See WSDL Web sites development evolution, 954–56 Web.Config file, 57, 971–72 Win32 COM and, 532, 533 continuing need for, 6, debug target, 45–46 and DLLs, 495–500 release target, 45–46 WinBase class, 730 window procedures, 73 windowing, ATL, 732–34 Windows See Microsoft Windows windows See also splitter windows creating, 73 default rectangle, 342 maximizing, 341 Windows common dialog boxes adding a button to standard file dialog box, 161–66 adding other controls, 166–67 overview, 159 Windows Explorer associating documents with programs, 415–16 double-clicking on documents, 415, 416, 425 enabling drag and drop, 415, 416, 425 launching programs, 415, 416–17, 425 MDI applications and, 425 SDI applications and, 415–17 Windows Forms creating applications with wizard, 929–32 drawing operations, 934–51 intercepting commands, 946 intercepting move messages, 946–47 limitations, 951 overview, 927–29 role in NET, 928 structure, 928–29 Windows Graphics Device Interface (GDI) See Graphics Device Interface Windows menus See menus Windows message processing handling in Windows Forms, 946–47 overview, 3–4, 257 single-threaded programs, 258–64 Windows programming model dynamic-link libraries, Graphics Device Interface (GDI), 4–5 memory management, message processing, 3–4, 257 overview, 3–6 resource-based programming, This document is created with a trial version of CHM2PDF Pilot http://www.colorpilot.com Win32 API, 6, 532 Windows Registry associating documents with programs, 415–16 COM and, 552–53 control bar status and, 341 overview, 336, 338–39 registering type libraries, 636–37 Windows Task Manager, 242 Windows-based printing, 437–39 WinHelp calling from within applications, 480–82 context-sensitive help and, 480–84 vs HTML Help, 471–73 improved table of contents, 479 in MFC applications, 473–79 overview, 471–72 WinHelp function, 480–81 WinInit vs asynchronous moniker files, 848 callbacks and, 839, 841–43 creating with MFC WinInit classes, 844–45 MFC classes, 839–41 overview, 838 simplified client program, 843–44 vs Winsock, 838–39 WinMain function, 3–4, 25, 42 Winsock blocking socket classes, 821–30 HTTP client program example, 832–34 HTTP server program example, 830–32 initializing, 830 MFC classes, 820–21 overview, 820 synchronous vs asynchronous programming, 820 vs WinInit, 838–39 wizards See also MFC Application Wizard Add Class From ActiveX Control Wizard, 215 Add Class From Typelib Wizard, 619, 622 Add Class Wizard, 514, 593, 597–98, 617 Add Member Function Wizard, 451–52 Add Member Variable Wizard, 146–47, 220, 221–22, 226, 364, 451–52, 521–22, 523 Add Method Wizard, 593–94, 617 Add Property Wizard, 593–94, 617 ATL Control Wizard, 725–29 ATL OLE DB Consumer Wizard, 783 ATL OLE DB Provider Wizard, 778–79, 789–94 ATL Project Wizard, 694–96, 703, 725, 860 ATL Property Page Wizard, 748, 749, 750 ATL Server Project Wizard, 882 ATL Simple Object Wizard, 697–98, 701–2 code, 71–73 creating, 51–53 for creating Managed C++ applications, 914 Custom Wizard template, 53–60 how they work, 50–51 Implement Connection Point Wizard, 763 Managed C Windows Forms Wizard, 929–32 ManagedCWebFormWizard sample, 53–59 MFC Class Wizard, 136, 145–46, 162–63, 170, 562 role in Visual Studio NET, 49, 59 source code for Visual C++ NET wizards, 50 support for COM in-process components, 560–62 two types, 49–50 with and without user interfaces, 49–50 WM_CHAR message, 4, 82 WM_CLOSE message, 4, 86 WM_COMMAND message, 180, 212, 512–13 WM_CONTEXTMENU message, 307 WM_COPYDATA message, 253 WM_CREATE message, 4, 86, 232, 235 WM_CTLCOLOR message, 157, 158, 359 WM_DESTROY message, 87 WM_DROPFILES message, 416 WM_HELP message, 225 WM_HSCROLL message, 155, 156, 179, 183 This document is created with a trial version of CHM2PDF Pilot http://www.colorpilot.com WM_KEYDOWN message, 82, 83–84 WM_KEYUP message, 82 WM_LBUTTONUP message, 108 WM_MOUSEMOVE message, 108, 327 WM_NCDESTROY message, 87 WM_NOTIFY message, 180–81, 293 WM_PAINT message, 64, 738 WM_PALETTECHANGED message, 115, 127 WM_QUERYENDSESSION message, 86 WM_QUERYNEWPALETTE message, 115, 127 WM_SIZE message, 235, 290 WM_TIMER message, 259, 260, 735, 741–42 WM_VSCROLL message, 155, 179, 183 WndProc function, 511, 512, 933 WORD type, 394 worker threads defined, 264 relationship to main thread, 266–67 writing functions, 264–65 wrapper classes for ActiveX controls, 217–20 vs class data members, 221–22 utilities for, 908 Write function, 124, 826, 960 WriteFile function, 392 WriteProfileInt function, 338 WriteProfileString function, 338 WSDL (Web Services Description Language), 978–79 WYSIWYG printing, 442–49 This document is created with a trial version of CHM2PDF Pilot http://www.colorpilot.com Index X XML (Extensible Markup Language), 954, 993–95 See also Web.Config file This document is created with a trial version of CHM2PDF Pilot http://www.colorpilot.com List of Figures Chapter 1: Windows and Visual C++ NET Figure 1-1: The Visual C++ MFC application build process Figure 1-2: Visual C++ NET windows Figure 1-3: The Visual C++ NET debugger window Chapter 2: The Microsoft Foundation Class Library Application Framework Figure 2-1: The document-view relationship Chapter 3: Getting Started with the MFC Application Wizard Figure 3-1: The Visual C++ NET precompiled header process Chapter 4: Visual C++ NET Wizards Figure 4-1: Default.htm of the ManagedCWebFormWizard application in the finished wizard Chapter 5: Windows Message Mapping Figure 5-1: A square drawn after the origin has been moved to (100, 100) Figure 5-2: A centered ellipse drawn in the MM_ANISOTROPIC mapping mode Figure 5-3: A centered ellipse drawn in the MM_ISOTROPIC mapping mode Chapter 6: Classic GDI Functions, Fonts, and Bitmaps Figure 6-1: : Font height measurements Figure 6-2: The layout for a BMP file Chapter 7: Dialog Boxes Figure 7-1: The finished dialog box in action Figure 7-2: The Delete File dialog box in action Chapter 8: Common Controls Figure 8-1: The Windows common controls dialog box Figure 8-2: Advanced common controls in a dialog box Figure 8-3: The fields of an IP address control Chapter 9: Using ActiveX Controls Figure 9-1: The calendar control in use Chapter 10: Win32 Core Memory Management Figure 10-1: A typical Windows 95/98 virtual memory map for two processes linked to the same EXE file Figure 10-2: Win32 virtual memory management (Intel) Chapter 11: Windows Message Processing and Multi-Threaded Programming Figure 11-1: The Compute dialog box Chapter 12: Menus, Keyboard Accelerators, the Rich Edit Control, and This document is created with a trial version of CHM2PDF Pilot http://www.colorpilot.com Chapter 12: Menus, Keyboard Accelerators, the Rich Edit Control, and Property Sheets Figure 12-1: The child windows within an SDI main frame window Figure 12-2: Submenus (shown in Microsoft Visual C++ NET) Figure 12-3: The standard SDI frame menus Figure 12-4: The Ex12a program in use Figure 12-5: The property sheet from Ex12a Chapter 13: Toolbars and Status Bars Figure 13-1: A toolbar bitmap and an actual toolbar Figure 13-2: The Ex13a program in action Figure 13-3: The status bar and the indicators array Figure 13-4: The status bar of the Ex13b example Figure 13-5: Rebar terminology Figure 13-6: Ex13c rebar example Chapter 15: Separating the Document from Its View Figure 15-1: The Ex15a program in action Figure 15-2: The Ex15b program in action Chapter 16: Reading and Writing Documents Figure 16-1: The serialization process Figure 16-2: Class relationships Figure 16-3: Object relationships Figure 16-4: The Ex16b application with two files open Figure 16-5: The MDI frame–view window relationship Chapter 17: Printing and Print Preview Figure 17-1: The standard Print dialog box Figure 17-2: The Document Properties dialog box Chapter 18: Splitter Windows and Multiple Views Figure 18-1: A single view window with a four-way split Figure 18-2: The CStringView view and the CHexView view of the document Chapter 21: MFC Programs Without Document or View Classes Figure 21-1: The Ex21a Calculator dialog box Chapter 22: The Component Object Model Figure 22-1: Subfolders of four class IDs in the Registry Figure 22-2: Human-readable program IDs in the Registry Chapter 23: Automation Figure 23-1: An Excel spreadsheet that uses VBA code Figure 23-2: The VBA code for the Excel spreadsheet Figure 23-3: An Excel workbook controlling the Ex23a component Figure 23-4: The Ex23b DLL dialog box in action Figure 23-5: A sample menu structure for a standard SDI application This document is created with a trial version of CHM2PDF Pilot http://www.colorpilot.com Figure 23-5: A sample menu structure for a standard SDI application Figure 23-6: The Add Class From Typelib Wizard can create C++?? classes for the Excel objects listed in Excel's type library Chapter 24: Uniform Data Transfer: Clipboard Transfer and OLE Drag and Drop Figure 24-1: MFC OLE Clipboard processing Figure 24-2: The Ex24a program in operation Figure 24-3: MFC OLE drag-and-drop processing Chapter 25: Introducing the Active Template Library Figure 25-1: Selecting the ATL Project Wizard in the New Project dialog box Figure 25-2: The Application Settings page of the ATL Project Wizard Figure 25-3: Using the ATL Simple Object Wizard to insert a new ATL-based COM class into the project Figure 25-4: Adding a method to an interface Figure 25-5: The layout of a dual interface Chapter 26: ATL and ActiveX Controls Figure 26-1: The Names page of the ATL Control Wizard Figure 26-2: The Options page of the ATL Control Wizard Figure 26-3: The Appearance page of the ATL Control Wizard Figure 26-4: The Stock Properties page of the ATL Control Wizard Figure 26-5: A bitmap for the dice control Figure 26-6: The Microsoft Calendar 9.0 control executing the properties verb Figure 26-7: Visual C++ NET inserting the Calendar 9.0 property pages into its own dialog box for editing resource properties Figure 26-8: The property page dialog template Figure 26-9: How the property pages, property frame, and property page sites communicate Chapter 27: The OLE DB Templates Figure 27-1: The ATL OLE DB Consumer Wizard Chapter 28: Internet Essentials Figure 28-1: The stack for a LAN running TCP/IP Figure 28-2: A simple IP datagram layout Figure 28-3: A simple UDP layout Figure 28-4: The relationship between the IP datagram and the UDP datagram Figure 28-5: The layout of a Class C IP address Figure 28-6: A simple layout of a TCP segment Figure 28-7: The relationship between an IP datagram and a TCP segment Figure 28-8: Consolidated Messenger's domain configuration Chapter 29: Introducing Dynamic HTML Figure 29-1: A very basic HTML page, as seen in Internet Explorer Figure 29-2: The basic hierarchy of the DHTML object model Figure 29-3: The Ex29a example Figure 29-4: The Ex29b example in action Figure 29-5: The Ex29c ActiveX control This document is created with a trial version of CHM2PDF Pilot http://www.colorpilot.com Chapter 30: ATL Server Figure 30-1: The Internet Service Manager screen Figure 30-2: The IIS Directory Security property page Figure 30-3: The IIS Authentication Methods property sheet Figure 30-4: The Anonymous User Account dialog box Figure 30-5: The \WebHome WWW home directory property page Figure 30-6: The Weathermap HTML Form window Figure 30-7: The ATL Server architecture Figure 30-8: The ATL Server application in action Chapter 31: Microsoft NET Figure 31-1: COM boundary crossings Figure 31-2: Common language runtime components don't have to worry about boundary crossings Figure 31-3: Common language runtime components distributed between multiple AppDomains Chapter 32: Managed C++ Figure 32-1: The Ex32a assembly as viewed through ILDASM Figure 32-2: Running the Ex32b console application Chapter 33: Programming Windows Forms Using Managed C++ Figure 33-1: The Ex33a sample in action Figure 33-2: The Ex33b sample in action Figure 33-3: The Ex33c sample in action Chapter 34: Programming ASP.NET Using Managed C++ Figure 34-1: A very simple ASPX page reflected by ILDASM Figure 34-2: Output generated by the code-behind page Figure 34-3: The code-behind DLL as reflected by ILDASM Figure 34-4: Ex34a with server-side controls Figure 34-5: The Ex34b module dumping context information and stopping every other request Figure 34-6: The Application Configuration property sheet within IIS showing the list of file-to-ISAPI DLL mappings Figure 34-7: Adding a new file extension to the list of file-to-ISAPI DLL mappings Figure 34-8: WSDL code generated by Ex34d Chapter 35: Programming ADO.NET Using Managed C++ Figure 35-1: The relationship between the ADO.NET managed providers, SQL Server, OLEDB providers, and COM Figure 35-2: The architecture of the ADO.NET DataSet This document is created with a trial version of CHM2PDF Pilot http://www.colorpilot.com List of Tables Chapter 1: Windows and Visual C++ NET Table 1-1: File Types Generated in Visual C++ NET Projects Chapter 3: Getting Started with the MFC Application Wizard Table 3-1: Important Files in the Application's Subdirectory Table 3-2: Windows Resources Contained in MFC Applications Table 3-4: MFC Application Wizard Default Project Settings Chapter 4: Visual C++ NET Wizards Table 4-1: Files Generated by the Custom Wizard_ (continued) Chapter 5: Windows Message Mapping Table 5-1: The Scale Factor for Mapping Modes Chapter 6: Classic GDI Functions, Fonts, and Bitmaps Table 6-1: Logical Inches vs Physical Inches Chapter 7: Dialog Boxes Table 7-1: CCommonDialog Classes Table 7-2: Modal vs Modeless Dialog Boxes Chapter 9: Using ActiveX Controls Table 9-1: Properties, Methods, and Events of the Calendar Control Chapter 10: Win32 Core Memory Management Table 10-1: Important Sections of a Program Chapter 12: Menus, Keyboard Accelerators, the Rich Edit Control, and Property Sheets Table 12-1: Commonly Used CRichEditCtrl Functions Chapter 13: Toolbars and Status Bars Table 13-1: Toolbar States Chapter 16: Reading and Writing Documents Table 16-1: Types Supported by CArchive's Insertion and Extraction Operators Table 16-2: Files and Classes in Ex16a Table 16-3: Files and Classes in Ex16b Table 16-4: Files and Classes in Ex16c Chapter 17: Printing and Print Preview Table 17-1: Overridable CView Print Loop Functions Chapter 27: The OLE DB Templates This document is created with a trial version of CHM2PDF Pilot http://www.colorpilot.com Table 27-1: Data Source Object Interface Requirements Table 27-2: Command Object Interface Requirements Table 27-3: Session Object Interface Requirements Table 27-4: Rowset Object Interface Requirements Table 27-5: OLE DB Consumer Attributes Chapter 32: Managed C++ Table 32-1: Managed Extensions for C++ Chapter 35: Programming ADO.NET Using Managed C++ Table 35-1: ADO.NET Interfaces and Their Implementations Appendix A: Message Map Functions in the MFC Library Handlers for WM_COMMAND Messages Handlers for Child Window Notification Messages Handlers for Window Notification Messages User-Defined Message Codes This document is created with a trial version of CHM2PDF Pilot http://www.colorpilot.com List of Listings Chapter 5: Windows Message Mapping Ex05aView.H Ex05aView.cpp Chapter 9: Using ActiveX Controls ActiveXDialog.h ActiveXDialog.cpp Chapter 11: Windows Message Processing and Multi-Threaded Programming HMS.h Chapter 12: Menus, Keyboard Accelerators, the Rich Edit Control, and Property Sheets Property.h Property.cpp Chapter 14: A Reusable Frame Window Base Class Persist.h Persist.cpp Chapter 15: Separating the Document from Its View Student.h Student.cpp Ex15bDoc.h Ex15bDoc.cpp Ex15bView.h Ex15bView.cpp Chapter 16: Reading and Writing Documents Ex16a.h Ex16a.cpp MainFrm.h MainFrm.cpp Ex16b.h Ex16b.cpp MainFrm.h MainFrm.cpp ChildFrm.h ChildFrm.cpp Chapter 20: Dynamic-Link Libraries Ex20d.cpp RygWnd.h This document is created with a trial version of CHM2PDF Pilot http://www.colorpilot.com RygWnd.cpp Chapter 22: The Component Object Model Interface.h Spaceship.h Spaceship.cpp Client.cpp Interface.h Spaceship.h Spaceship.cpp Chapter 23: Automation Ex23bAuto.h Ex23bAuto.cpp BankDriver.h AutoDriver.h ClockDriver.h CAlarm.h Chapter 24: Uniform Data Transfer: Clipboard Transfer and OLE Drag and Drop Ex24aView.h Ex24aView.cpp Chapter 28: Internet Essentials Blocksock.h Chapter 33: Programming Windows Forms Using Managed C++ Source.cpp Source.cpp Source.cpp Chapter 34: Programming ASP.NET Using Managed C++ Ex34a.h Ex34b.h Ex34c.h This document is created with a trial version of CHM2PDF Pilot http://www.colorpilot.com List of Sidebars Chapter 3: Getting Started with the MFC Application Wizard For Win32 Programmers Chapter 5: Windows Message Mapping For Win32 Programmers For Win32 Programmers Chapter 6: Classic GDI Functions, Fonts, and Bitmaps For Win32 Programmers For Win32 Programmers For Win32 Programmers Chapter 8: Common Controls About Icons CTime vs COleDateTime Chapter 9: Using ActiveX Controls For Win32 Programmers Chapter 10: Win32 Core Memory Management For Win32 Programmers Chapter 14: A Reusable Frame Window Base Class Unicode Chapter 15: Separating the Document from Its View Window Subclassing for Enhanced Data-Entry Control Chapter 23: Automation Debugging an EXE Component Program Parameters Passed by Reference Debugging a DLL Component Chapter 25: Introducing the Active Template Library Attributed ATL vs Classic ATL Chapter 28: Internet Essentials Classic Internet Development vs .NET Development This document is created with a trial version of CHM2PDF Pilot http://www.colorpilot.com CD Content Following are select files from this book's Companion CD-ROM These files are for your personal use, are governed by the Books24x7 Membership Agreement, and are copyright protected by the publisher, author, and/or other third parties Unauthorized use, reproduction, or distribution is strictly prohibited Click on the link(s) below to download the files to your computer: File All CD Content Vcppnet Description Programming with Microsoft Visual C++ NET, Sixth Edition Size 16,923,493 16,744,645 ... send them to Microsoft Press using postal mail or e-mail: Microsoft Press Attn: Programming with Microsoft Visual C++ NET Editor One Microsoft Way Redmond, WA 98052-6399 mspinput@microsoft.com... created Microsoft Visual C++ This document is created with a trial version of CHM2PDF Pilot http://www.colorpilot.com Programming with Microsoft Visual C++ NET, Sixth Edition George Shepherd with. .. This edition of Programming with Microsoft Visual C++ NET is about 32-bit programming for Windows 98/Me and Windows NT/2000/XP using the Win32 API If you really need to 16-bit programming, I suggest

Ngày đăng: 26/03/2019, 11:12