Sams Publishing
Total Page:16
File Type:pdf, Size:1020Kb
00 0672324806 FM 12/12/02 2:40 PM Page i Bob Swart, Mark Cashman, Paul Gustavson, and Jarrod Hollingworth Borland C++Builder 6 Developer’s Guide 201 West 103rd Street, Indianapolis, Indiana 46290 00 0672324806 FM 12/12/02 2:40 PM Page ii Borland C++Builder 6 Developer’s Guide Associate Publisher Michael Stephens Copyright © 2003 by Sams Publishing All rights reserved. No part of this book shall be reproduced, stored Acquisitions Editor in a retrieval system, or transmitted by any means, electronic, Carol Ackerman mechanical, photocopying, recording, or otherwise, without Development Editor written permission from the publisher. No patent liability is Songlin Qiu assumed with respect to the use of the information contained herein. Although every precaution has been taken in the prepara- Managing Editor tion of this book, the publisher and author assume no responsibil- Charlotte Clapp ity for errors or omissions. Nor is any liability assumed for damages resulting from the use of the information contained herein. Project Editor Matthew Purcell International Standard Book Number: 0-672-32480-6 Copy Editor Library of Congress Catalog Card Number: 2002109779 Chip Gardner Printed in the United States of America Indexer First Printing: December 2002 Erika Millen 05 04 03 02 4321 Proofreaders Leslie Joseph Trademarks Suzanne Thomas All terms mentioned in this book that are known to be trademarks Technical Editor or service marks have been appropriately capitalized. Sams Paul Qualls Publishing cannot attest to the accuracy of this information. Use of a term in this book should not be regarded as affecting the validity Team Coordinator of any trademark or service mark. Lynne Williams Multimedia Developer Warning and Disclaimer Dan Scherf Every effort has been made to make this book as complete and as Interior Designer accurate as possible, but no warranty or fitness is implied. The Gary Adair information provided is on an “as is” basis. The authors and the publisher shall have neither liability nor responsibility to any Cover Designer person or entity with respect to any loss or damages arising from Alan Clements the information contained in this book or from the use of the CD or programs accompanying it. Page Layout Juli Cook Graphics Steve Adams Tammy Graham Oliver Jackson Laura Robbins 00 0672324806 FM 12/12/02 2:40 PM Page iii Contents at a Glance Introduction .................................................................................1 Part I C++Builder Essentials 5 1 Introduction to C++Builder .............................................................7 2 C++Builder Projects and More on the IDE ........................................33 3 Programming in C++Builder...........................................................81 4 Creating Custom Components .....................................................185 5 Creating Property and Component Editors .....................................291 Part II Database Programming 373 6 Borland Database Component Architecture.....................................375 7 Database Programming................................................................383 8 The Borland Database Engine .......................................................397 9 Client Datasets and Client Dataset Enhancements ...........................409 10 Interbase Express Component Overview .........................................417 11 ADO Express Components for C++Builder ......................................435 12 Data Access with dbExpress ..........................................................453 13 XML Document Programming and XML Mapper .............................467 Part III Windows Programming 489 14 Win 32 API Functional Areas ........................................................491 15 Graphics and Multimedia Techniques ............................................579 16 DLLs ........................................................................................627 17 COM Programming ....................................................................667 Part IV Distributed Computing 713 18 DCOM: Going Distributed ...........................................................715 19 SOAP and Web Services with BizSnap.............................................749 20 Distributed Applications with DataSnap .........................................775 21 DataSnap Multitier Connections ...................................................811 22 Web Server Programming with WebSnap ........................................835 00 0672324806 FM 12/12/02 2:40 PM Page iv Part V Open Tools API 875 23 The Tools API: Extending the Borland IDE ......................................877 Part VI Appendixes 929 A C++Builder Example Applications..................................................931 B C++ Mobile Application Development ...........................................945 C Information Resources.................................................................973 D Enabling TXMLDocument for C++Builder Professional .....................993 Index......................................................................................1009 00 0672324806 FM 12/12/02 2:40 PM Page v Table of Contents Introduction 1 Who Should Read This Book? .........................................................1 How This Book Is Organized ...........................................................2 The Companion CD-ROM ..............................................................3 C++Builder System Requirements ....................................................3 Conventions Used in This Book ......................................................3 Part I C++Builder Essentials 5 1 Introduction to C++Builder 7 C++ Language ..............................................................................8 ANSI Compliance ..................................................................8 Microsoft Compatibility .......................................................10 Recommended Language References .......................................11 Borland Language Extensions and Standard Objects ..................11 try/finally .......................................................................14 The VCL, Forms, and Components .................................................14 The Form ...........................................................................15 The Component Palette ........................................................15 Events and Event Handlers ....................................................15 Testing the Program .............................................................18 Creating Your First Real Program ....................................................18 Commonly Asked Questions .........................................................24 What’s New in C++Builder 6? ........................................................25 Compatibility with Previous Releases—Projects .........................26 Compatibility with Previous Releases—Standard C++ Library ......26 Compatibility with Previous Releases—Database Program Changes ...........................................................................27 Compatibility with Previous Releases—DsgnIntf Renamed and Split Up .....................................................................27 Other New Features .............................................................27 Linux, Kylix, CLX, EJB, and C++Builder ..........................................28 CLX Overview ....................................................................28 Cross-Platform Help System Integration ..................................29 Simplified IDL, IIOP, and EJB .................................................29 00 0672324806 FM 12/12/02 2:40 PM Page vi vi Borland C++Builder 6 Developer’s Guide The C++ Standard Library .............................................................30 Containers .........................................................................30 Memory Management ..........................................................32 Summary ...................................................................................32 2 C++Builder Projects and More on the IDE 33 C++Builder IDE Features ...............................................................33 Main Window and Toolbars ..................................................33 Project Manager ..................................................................34 Arranging Windows in the IDE ..............................................34 Object Inspector ..................................................................36 Property Categories in the Object Inspector .............................37 The Object Tree View ...........................................................39 Source Code Editor ..............................................................39 Forms—Save As Text ............................................................43 Understanding C++Builder Projects ................................................44 Files Used in C++Builder Projects ...........................................45 Project Manager ..................................................................48 Different Builds for Different Files ..........................................49 Custom Build Tools ..............................................................50 Drag and Drop within Tree to Reorder Compilation ..................52 Understanding and Using Packages ................................................53 Considerations When Using Packages .....................................57 Using the C++Builder Interactive Debugger