C++Builder How-To
By John M. Miano, Tom Cabanski, and Harold Howe
Published by Waite Group Press
Want to bring your programming visions to reality using the ultimate programming language for Windows? If you do, simply leap into the pages of the Waite Group's easy-to-use "Borland C++Builder How-To", the definitive reference to Borland's white-hot, object-oriented development tool that combines C++'s awesome power with Delphi's winning productivity.
"Borland C++Builder How-To" allows intermediate and advanced programmers to dive in and develop business-critical client/server applications with C++Builder. Written in the Waite Group's award-winning "How do I..." format, "Borland C++Builder How-To" answers over 100 challenging questions, including how to display date, size, and time in status base, how to write simple communications programs, and how to use the MCI component to play MIDI music, WAV sound, and create multimedia presentations.
With scores of invaluable tips, tricks, and techniques, "Borland C++Builder How-To" is the C++Builder reference you'll turn to again and again in search of practical advice that will help you solve real-life problems with step-by-step solutions - along with warnings, enhancements, and alternative solutions, as well as the actual code.
The companion CD-ROM includes all the How-To examples and solutions from the book, fully encapsulated code, resource, bitmaps, and applications. Programs include a 30-day trial version of C++Builder, NViewLib, ImageLib Corporate Suite trial version, Bison Flex, TwistedPixel Imaging OCX, TCaptionControl, and scrPlus.
Contains a complete example of how to create a custom aircraft instrument control.
Table of Contents
Chapter 1 Forms
1.1 Automatically Center a Form in My Application 1.2 Create a Form on the Fly at
Runtime
1.3 Drag a Captionless Window
1.4 Set Minimum and Maximum Sizes for My Forms
1.5 Make [ENTER] Act Like [TAB] in My Forms
1.6 Paint an Interesting Background on an MDI Parent Form
1.7 Customize a Windows Title Bar with Graphics
1.8 Ask Whether the User Really Wants to Close a Form
1.9 Show a Splash Screen When the Program Starts
1.10 Display My Own Modal Dialog Box
Chapter Standard Components and Classes
2.1 Use the String Class
2.2 Use Properties with Set Values
2.3 Create a Combo Box That Best Matches User Input
2.4 Use Drag-and-Drop to Move Items from One List Box to Another
2.5 Add a Horizontal Scroll Bar to a List Box
2.6 Add Images to a List Box
2.7 Create a Windows 95-Style Scroll Bar
2.8 Create a Multipage Dialog Box
2.9 Create a Multipanel Status Bar
Chapter 3 Text Controls
3.1 Create a Simple Word Processor
3.2 Add Search and Replace Functions to My Word Processor
3.3 Use Different Fonts in My Word Processor
3.4 Add Cut and Paste to My Word Processor
3.5 Implement Undo in a Word Processor
3.6 Create a Right-Justified Edit Box
3.7 Create a Font Selection Combo Box
3.8 Limit Text Entry to Certain Characters
Chapter 4 Mouse and Menu
4.1 Create and Use My Own Mouse Cursor
4.2 Modify the Menu at Runtime
4.3 Display a File History List in a Menu
4.4 Put Pictures in Menus
4.5 Create and Use Custom Check Marks in Menus
4.6 Use a Different Font in a Menu
4.7 Use a Popup Menu
Chapter 5 Graphics
5.1 Use a Canvas to Draw on a Form
5.2 Visualize the Pen Mode Settings
5.3 Draw a Bounding Box with the Mouse
5.4 Create Hot Spots in Pictures
5.5 Load Icons from a Resource File and Display Them on a Form
5.6 Create Animation
5.7 Fade One Picture into Another
5.8 Fade Text In and Out over a Background
5.9 Draw with a True Cartesian Coordinate System
5.10 Translate a System Color into an Actual Color
5.11 Draw a Bitmap with a Transparent Background
5.12 Autosize a Form to Fit a Picture and Autosize a Picture to Fit a Form
5.13 Write a Screen Saver
Chapter 6 Environment and System
6.1 List Files as in File Manager
6.2 Run Another Program from My Application
6.3 Restart Windows
6.4 Search an Entire Disk for a File
6.5 Disable the Windows Screen Saver
6.6 Prevent Multiple Instances of My Program from Being Loaded
6.7 Determine the Directory Where Windows Is Located
6.8 Determine How Much System Memory Is Available
6.9 Determine What Version of Windows Is Running
6.10 Display an Icon in the Windows Tray
6.11 Find and Set Environment Variables
6.12 Drag and Drop Files
6.13 Determine Which Programs Are Running
6.14 Find Out Which Disk Drives Are Available and How Much Disk Space There Is
Chapter 7 Peripherals
7.1 Use the Modem to Dial a Voice Call
7.2 Send and Receive Data Through a Serial Port
7.3 Determine Whether There Is a Disk in a Floppy or CD-ROM Drive
7.4 Determine the Color Capabilities of a Monitor or Printer
Chapter 8 Internet
8.1 Create a Basic HTML Browser
8.2 Send Mail Through the Internet
8.3 Create a Basic CGI Application
8.4 Create a Basic ISAPI Application
8.5 Communicate Between Programs over the Internet
Chapter 9 Multimedia
9.1 Determine Whether a System Has a Sound Card
9.2 Play Wave and MIDI Files
9.3 Play Video Files in My Form
9.4 Play an Audio CD
9.5 Detect and Use a Joystick in My Application
9.6 Display JPEG and GIF Files
Chapter 10 Printing
10.1 Print Simple Text Documents
10.2 Allow the User to Select a Page Range to Print
10.3 Maintain the Same Appearance on the Printed Page as on the Screen
10.4 Show Print Spooler Status
10.5 Create a Simple Report Using Quick Reports
Chapter 11 Database
11.1 View the Contents of a Database
11.2 View the Contents of a Database Using SQL
11.3 Use VCL Components to Automatically Display and Edit Database Information
11.4 Use VCL Components to Navigate a Database
11.5 Search a Database
11.6 Edit a Database Without Using Data-Aware Controls
11.7 Control the Layout of Database Table Displays at Design Time
11.8 Control the Layout of Database Table Displays at Runtime
11.9 Use Lookup Controls in a Relational Database
11.10 Create a BDE Alias at Runtime
Chapter 12 Threads
12.1 Create a Separate Thread of Execution
12.2 Access the Screen from a Background Thread
12.3 Safely Share Data Between Multiple Threads
12.4 Safely Share Limited Resources Between Multiple Threads
12.5 Make a Thread Wait for an Event to Occur
12.6 Start Threads with Different Priorities
12.7 Run a Query in a Background Thread
Chapter 13 OLE
13.1 Use Drag-and-Drop in My Application
13.2 Use OLE Objects in My Application
13.3 Create an Application That Can Be Controlled by Another Through OLE Automation
13.4 Control Another Application Through OLE Automation
Chapter 14 Exceptions
14.1 Display a Custom Message When an Exception Occurs
14.2 Create a Custom Exception Handler
14.3 Trap an Exception
14.4 Handle Hardware Exceptions
Chapter 15 Custom Components
15.1 Create a Custom Component from an Existing VCL Class
15.2 Use a Custom Component at Design Time
15.3 Create a Custom Component from Scratch
Chapter 16 The Polished Application
16.1 Make a Professional-Style About Box 715
16.2 Create and Display Separate Balloon and Status Bar Hints 722
16.3 Make a Form That Can Be Translated into Other Languages 725
16.4 Use the Registry to Store Application Configuration Information 728
16.5 Give the User the Ability to Customize Screen Labels 732
Chapter 17 Tricks and Tips
17.1 Evaluate a Numerical Expression
17.2 Create a Control Array like in Visual Basic
17.3 Edit a Control as Text
17.4 View the Contents of a .DFM File
17.5 Create a DLL
17.6 Use Modules Written in Delphi?
Publishing Information
Title: Borland C++ Builder How-To
Imprint: Waite Group Press
Author: John Miano, Tom Cabanski, and Harold Howe
ISBN: 157169109X
Publication Date: 06-1997
Retail Price: 49.99
ISBN: 157169109X
Retail Price: 49.99
Pages: 800
Reviews
Don't take our word for it. Read what people who have bought "C++Builder How-To" have said about it on Amazon.com.
How To Order
"C++Builder How-To" is in bookstores now! You can also order it directly from Amazon.com by clicking here.
Chapter 1 Forms
Chapter 2 Standard Components and Classes
Chapter 3 Text Controls
Chapter 4 Mouse and Menu
Chapter 5 Graphics
5.1 Use a Canvas to Draw on a Form
Where is the TColorGrid control?
The TColorGrid control is not installed in the C++Builder component palette when you install the product. This component is found in the EXAMPLES\CONTROLS directory where you installed C++Builder. To install TColorGrid start C++Builder. Select COMPONENT|INSTALL from the menu. Click on the ADD button then click on the BROWSE button. In the "ADD COMPONENT" dialog box go to the "EXAMPLES\CONTROLS" directory and select the file "SAMPREG.CPP". This returns you to the "INSTALL COMPONENTS" dialog. Click on "OK". After the VCL library gets rebuilt you should find TColorGrid on the Samples page on the component palette.
5.4 Create Hot Spots in Pictures
When using the technique in the book, make sure you set the Scaled property of the form to false. This eliminates misalignment problems due to large font verses small font system settings. The EXE included on the CD was compiled without Scaled set to false. People who use the Large font setting may notice that the hot spots are not in synch with the continents on the map.
Chapter 6 Environment and System
Page 336: Figure 6-10 is incorrect. It should be this:
Chapter 7 Peripherals
Chapter 8 Internet
8.1 Create a Basic HTML Browser
I am getting a dialog box with the message Unexpected failure when I run the application?
Click here to download a zip file containing an update.
Chapter 9 Multimedia
Chapter 10 Printing
Chapter 11 Database
Chapter 12 Threads
Chapter 13 OLE
Chapter 14 Exceptions
Chapter 15 Custom Components
Chapter 16 The Polished Application
Chapter 17 Tricks and Tips
Source Code
The Colosseum Builders' Source Code Page has C++ and C++Builder code that may help you in your projects.
Contact The Authors
John M. Miano
Colosseum Builders, Inc.
miano@colosseumbuilders.com
Tom Cabanski
President, Object Advantage, Inc
tcabanski@objectadvantage.com
Harold Howe
Technology Resource Group
BCB Foundations Web Site
hhowe@gowebway.com