Visual basic : programmer's guide : version 4.0 /
Microsoft Corporation.
- Redmond, Washington : Microsoft, 1995
- 857 p.
CONTENIDO Document Conventions xi Programming Style in This Manual xii Chapter 1 Introduction 1 Setting Up 2 Visual Basic Editions 4 How This Book is Organized 4 Using Online Documentation 6 New Features in Visual Basic 4.0 11 Microsoft Product Support Services 13 Chapter 2 Your First Visual Basic Application 15 Starting Visual Basic 16 Steps to Creating a Visual Basic Application 19 Working with Sample Applications 26 Distributing Your Applications 34 Chapter 3 Creating and Using Controls 35 Visual Basic Controls 36 Clicking Buttons to Perform Actions 43 Displaying and Entering Text 45 Controls That Present Choices to the User 50 Getting and Setting the Focus of an Object 73 Setting the Tab Order 74 Enabling, Disabling, and Controlling Visibility at Run Time 76 Working with Control Arrays 77 Chapter 4 Managing Projects 83 Understanding Projects 84 Creating, Opening, and Saving Projects 87 Adding, Removing, and Saving Files 88 Creating New Forms and Modules 89 Adding and Removing Custom Controls 89 Using a Resource File 94 Making and Running an Executable File 96 Setting Visual Basic Options 98 Using Conditional Compilation 102 Installing Add-Ins 105 Editing the Autoload File 106 Chapter 5 Programming Fundamentals 109 Structure of a Visual Basic Application 109 Variables 113 Modules 115 Procedures 116 Control Structures 135 Code Writing Mechanics 144 Chapter 6 Variables, Constants, and Data Types 147 Declaring Variables 148 Scope and Lifetime of Variables 150 Constants 155 Data Types 158 Arrays 172 Creating your Own Data Types 177 Chapter 7 Introduction to Objects 181 What is an Object? 181 Communicating Between Objects 184 Working with Objects 186 Using the Object Browser 191 How are Objects Related to Each Other? 195 Creating Objects 199 Chapter 8 Using the OLE Container Control 235 Creating Front-End Applications 236 Using the OLE Container Control 239 Saving and Retrieving Data 254 Chapter 9 Programming Other Applications' Objects 257 What Can You Do with Objects? 258 Using OLE Automation Objects 261 Using an Object's Methods and Properties 271 The Object Hierarchy 274 Releasing an Object 278 Objects Without Visual Interfaces 280 Handling Run-Time Errors 281 The Server Busy Dialog Box 282 Chapter 10 Menus 289 Creating Menus at Design Time 289 Controlling Menus at Run Time 301 Toolbars 309 Menu and Toolbar Negotiation 310 Chapter 11 Dialogs 315 Using Dialog Boxes 315 Modal and Modeless Dialog Boxes 316 Using Predefined Dialog Boxes 317 Using Forms as Custom Dialog Boxes 319 Using the Common Dialog Control 325 Chapter 12 Responding to Mouse Events 333 Mouse Events 333 Positioning a Control with the Mouse 334 Graphical Mouse Applications 335 The Button and Shift Arguments 339 Dragging and Dropping 344 Changing the Shape of the Mouse Pointer 350 Chapter 13 Using the Grid Control 351 The Grid Control 351 Creating and Sizing Rows and Columns 352 Using Text in the Grid Control 354 Using Graphics in the Grid Control 358 Selecting and Highlighting Cells 359 Adding and Removing Rows 362 Chapter 14 Multiple-Document Interface (MDI) Applications 365 Using MDI in Visual Basic 366 Creating an MDI Application 366 MDI Text Writer-A Document-Centered Application 368 Working with MDI Forms and Child Forms 370 Menus in MDI Applications 374 Chapter 15 Creating Graphics for Applications 385 The Fundamentals of Graphics 385 Using Graphical Controls 389 Using Graphics Methods 401 Using Graphics Properties 417 Chapter 16 Displaying and Printing Information 437 Fonts 437 Setting Font Characteristics 439 Displaying Text on Forms and Picture Boxes 442 Formatting Numbers, Dates, and Times 446 Printing 449 Trapping Printer Errors 456 Chapter 17 Interacting with the Environment 457 Working with Selected Text 458 Using the Clipboard Object 458 Using Timer Controls 463 Working With Application Settings 466 Background Processing 470 Writing Low-Level Keyboard Handlers 474 Chapter 18 Using the File-System Controls 481 Examining the File System 482 A File Seeker Application 488 Chapter 19 Processing Files 493 Overview of File Access Types 494 Sequential Access 495 Random Access 497 Binary Access 501 Chapter 20 Debugging 503 Approaches to Debugging 504 Design Time, Run Time, and Break Mode 507 Using the Debug Window 509 Using Break Mode 510 Running Selected Portions of Your Application 519 Using the Calls Dialog Box 521 Testing Data and Procedures with the Immediate Pane 523 Special Considerations in Debugging Events 530 Testing and Using Command-Line Arguments 531 Using Conditional Compilation 532 Using Compile on Demand 532 Avoiding Bugs 533 Chapter 21 Handling Run-Time Errors 535 How to Handle Errors 535 Unanticipated Errors 543 Generating Errors 547 Inline Error Handling 547 Centralized Error Handling 551 Turning Off Error Handling 555 Error Handling with OLE Automation Objects 556 Chapter 22 Accessing Databases with the Data Control 561 What's New in Visual Basic Version 4.0 562 Using the Data Control 562 Using Bound Controls 569 Manipulating Records with Code 573 Controlling Transactions, Validation, and Updates 584 Understanding Database Design and Structure 589 Chapter 23 Using the Data-Bound Controls 593 Types of Bound Controls 593 Incorporating Bound Controls in Your Application 595 Chapter 24 Using the Data-Bound Grid 605 A Quick Start 606 Design-time Operations 607 Run-time Operations 609 Working with Ranges 609 Displaying Calculated Fields 610 Chapter 25 Dynamic Data Exchange (DDE) 611 What Is Dynamic Data Exchange? 612 Creating DDE Links at Design Time 615 Link Properties 617 Link Events 623 Allowing Users to Create Their Own Automatic Links 627 Using Methods to Perform DDE Operations 631 Handling Errors 635 Sending Keystrokes to Other Applications 638 Chapter 26 Calling Procedures in DLLs 641 Overview 642 Declaring a DLL Procedure 643 Passing Specific Data Types 648 Converting C Declarations to Visual Basic 657 Chapter 27 Optimizing Your Application for Size and Speed 659 Speeding Calculations and Code 660 Speeding Display 662 Speeding the Start of y our Application 664 Minimizing Total Application Size in Memory 664 Minimizing Memory Required by Graphics 667 Minimizing Stack Use 668 Chapter 28 Programming for 16-Bit Systems 671 Choosing Development and Target Platforms 672 Data and Variables 673 ANSI and Unicode Character Sets 673 Calling DLL Procedures 678 Graphics 681 Creating Common-Code Applications 681 Using Application Settings 682 Chapter 29 International Issues 685 Developing International Applications with Visual Basic 686 Writing Code for International Use 695 Issues Specific to the Double-Byte Character Set (DBCS) 707 Testing Y our International Visual Basic Application 710 Chapter 30 Distributing Your Applications 713 Using Setup Wizard on 16-Bit vs. 32-Bit Platforms 715 Using the Visual Basic Setup Wizard 715 Creating a Custom Setup Program 725 Appendix A Form and Project File Formats 743 Form Structure 743 Properties 747 Basic Code 750 Sample Form 750 Printing Forms 753 Loading and Saving Forms 753 Project File (.VBP) Format 756 Appendix B Icon Library 761 Arrows and Pointers 762 Communication 763 Computers 764 Drag-and-Drop 765 Elements 766 Flags 766 Industry and Transportation 767 Mail 767 Miscellaneous 768 Office 770 Traffic Signs 771 Writing 772 Appendix C Compatibility with Other Versions 775 Visual Basic 1.0 for Windows 775 Visual Basic 2.0 for Windows 775 Visual Basic 3.0 for Windows 776 Appendix D Specifications and Limitations 783 System Requirements for Visual Basic Applications 783 Project Limitations 784 Control Limitations 785 Windows Limitations 788 Appendix E Accessibility for People with Disabilities 789 Microsoft Services for People Who Are Deaf or Hard-of-Hearing 790 Access Packs for Microsoft Windows and Microsoft Windows NT 790 Keyboard Layouts for Single-Handed Users 791 Microsoft Documentation in Alternative Formats 792 Third-Party Utilities to Enhance Accessibility 792 Customizing Windows or Windows NT 793 Getting More Information for People with Disabilities 793