Sie sind auf Seite 1von 300

User’s Guide

®
Turbo C ++ for Windows
I n t r o d u c t i o n
Copyright
Agreement

Turbo C++ is a powerful, professional programming tool for creating and maintaining
16-bit Windows applications. Turbo C++ supports both the C and C++ languages with
its integrated development environment.
This manual is divided into two parts. Part I introduces you to the integrated
development environment (commonly known as the IDE). Part II teaches you how to
use Resource Workshop to build resources for your Windows applications. In addition,
this manual contains three appendixes which describe EasyWin (a library that converts
your DOS programs to Windows programs), the Turbo C++ precompiled header files,
and the error messages that can be generated by the Turbo C++ programming tools.

What’s new in Turbo C++


Turbo C++ 4.5 has many new features and additions. The following is a brief list of
major additions and changes:
• The compiler provides improved code generation and faster compilation times.
• ObjectComponents, a new set of C++ classes, lets you easily implement OLE 2.0 in
your applications. See the ObjectWindows Programmer’s Guide for more information.
• ObjectWindows (OWL) 2.5 contains new classes that give you access to OLE 2.0
through ObjectComponents. See the ObjectWindows Programmer’s Guide for more
information.
• OLE 2.0 support was added to AppExpert and ClassExpert. See Chapter 4 and
Chapter 5 in this book for more information.
• A Dialog Client application model was added to AppExpert, which lets you create an
application that uses a dialog box as its main user interface. See Chapter 4 for more
information.
• OpenHelp lets you quickly and easily search through multiple online Help files. See
“Searching through multiple Help files with OpenHelp” on page 4 for more
information.
• WinRun, lets you run Windows programs from a DOS box. See the ObjectWindows
Programmer’s Guide for more information.

Introduction 1
The following is a list of new features in version 4.5. This list is provided for those who
are upgrading from a version prior to Turbo C++ 4.5:
• The IDE has a graphical integrated debugger for debugging 16-bit Windows
applications.
• The IDE has an enhanced editor that lets you record keystroke macros, work in
multiple panes in one editor window, and search for text using regular expressions.
You can configure the editor to use Brief or Epsilon keystrokes or you can create your
own keystroke configurations.
• The right mouse button brings up SpeedMenus in the IDE that list commands specific
to the object you click. For example, some common editing commands are on the
SpeedMenu of all editor windows. (To access old functions of the right mouse button,
press Ctrl+click right mouse button.)
• The IDE has a new multiple-target Project Manager that visually shows file
dependencies and lets you manage more than one program.
• The IDE has a new multiple-window Browser that displays class relationships.
• The IDE has AppExpert and ClassExpert, which let you quickly generate
ObjectWindows 2.5 programs. Turbo C++ helps you modify and organize your
application.

Hardware and software requirements


To use Turbo C++, your computer must have
• DOS version 4.01 or higher
• Windows 3.1 or higher, running in enhanced mode
• An 80386 (or compatible) CPU or greater
• A hard disk with 40MB of available disk space for a normal installation (100MB for a
full installation)
• A 1.44 floppy drive or CD ROM (for installation)
• At least 4MB of extended memory to run the IDE (at least 8MB of extended memory
is recommended)
• A Windows-compatible mouse
Although not required, the following hardware greatly increases the performance of
Turbo C++:
• 8MB (or more) RAM
• An 80x87 math coprocessor (if you’re writing programs that use floating-point math).

2 User’s Guide
Manual conventions
This manual uses the following special fonts:

Monospace This type represents text that you type or text as it appears onscreen.
Italics These are used to emphasize and introduce words, and to indicate
variable names (identifiers), function names, class names, and structure
names.
Bold This type indicates reserved keywords, format specifiers, and command-
line options.
Keycap This type represents a particular key you should press on your keyboard.
For example, “Press Del to erase the character.”
Key1+Key2 This indicates a command that requires you to press Key1 with Key2. For
example, Shift+a (although not a command) indicates the uppercase letter
“A.”
ALL CAPS This type represents disk directories, file names, and application names.
(However, header file names are presented in lowercase to be consistent
with how these files are usually written in source code.)
Menu|Choice This represents menu commands. Rather than use the phrase “choose the
Save command from the File menu,” Borland manuals use the convention
“choose File|Save.”

Getting help
The Help system gives you online access to detailed information about Turbo C++. You
can find most product information in both the online manuals and online Help.
However, the following topics are covered only in online Help:

Introduction 3
• IDE menu commands
• Editor KEYMAPPER
• Example run-time library code
• Windows API
To display online Help
• In the IDE, choose Help from the menu or press F1.
• In dialog boxes, click the Help button or press F1.
• For menu commands, select the menu command and then press F1.

Searching through multiple Help files with OpenHelp


OpenHelp is a tool that lets you search through multiple online Help files from a single
dialog box. When you search for a keyword, OpenHelp searches through the keyword
lists of all the Help files that you specify; all your Windows Help files are now available
to you with a single Help command.
There are several ways to access OpenHelp:
• Click the Search All button on the Help button bar in any Borland Help file.
• Choose Help|Keyword Search in the Turbo C++ IDE (or press F1).
• Double-click the OpenHelp icon in the Turbo C++ group on your Windows desktop.
When you access OpenHelp, you can search through the Help files you specify to locate
the information you need. By default, OpenHelp searches through a predefined set of
Help files. The set of files that OpenHelp accesses is known as the search range. By
customizing OpenHelp, you can add new search ranges and modify existing ones to
create a Help system that suits your needs.
For more information on OpenHelp, and for instructions on customizing the OpenHelp
search ranges, press F1 inside Turbo C++, then search on the topic “Using OpenHelp.”

Software registration and technical support


The Borland Assist program offers a range of technical support plans to fit the different
needs of individuals, consultants, large corporations, and developers. To receive help
with Turbo C++, send in the registration card and select the Borland Assist plan which
best suits your needs. North American customers can register by phone 24 hours a day
by calling 1-800-845-0147. For additional details on these and other Borland services, see
the Borland Assist Support and Services Guide included with your Turbo C++ package.

4 User’s Guide
Part

I
Using the integrated development
Part I

environment
Part I of this manual describes how to use the components of the Turbo C++ integrated
development environment (IDE).
The IDE integrates development of 16-bit Windows applications. Using the Project
Manager, you can easily build several application types from a single project file.
AppExpert and ClassExpert let you take advantage of ObjectWindows 2.5. The
integrated debugger and browser let you debug your source code and browse class
objects and hierarchies without leaving the IDE.
The following chapters cover the tools available through the IDE:
• Chapter 1, “Getting started,” introduces you to the Turbo C++ IDE and takes you
though the creation of simple Windows programs.
• Chapter 2, “Creating and managing projects,” describes the Project Manager, and
shows you how to use the TargetExpert and Source Pools to create the projects for
your applications.
• Chapter 3, “Specifying project options and compiling,” shows you how to use Style
Sheets and local overrides to set your project options, and how to compile from the
IDE. In addition, Chapter 3 contains a complete reference to the options available for
both the IDE and the command line tools.
• Chapter 4, “Building applications with AppExpert,” describes AppExpert and
shows you how to create the source-code foundation for your ObjectWindows 2.5
applications.
• Chapter 5, “Modifying applications with ClassExpert,” describes how to modify the
applications you create using AppExpert.

Part I, Using the integrated development environment 5


• Chapter 6, “Browsing classes and objects,” shows you how to use the browser to
examine your C++ classes.
• Chapter 7, “Using the integrated debugger,” describes the integrated debugger,
which you can use to step and trace through your program code.

6 User’s Guide
Chapter

Getting started
Chapter 1
1
Turbo C++ is a development package that contains the compilers, tools, and utilities you
need for developing 16-bit Windows applications. You’ll find that you can accomplish
most of your application development using the integrated development environment
(IDE).
To help you get familiar with the IDE, this chapter offers an overview of the following
IDE features:
• Starting the Turbo C++ IDE
• Using SpeedMenus in the IDE
• Using the Edit window
• Working with simple projects
• Customizing the IDE
• Running other programs from the IDE

Starting the Turbo C++ IDE


After installing Turbo C++, the Program Manager contains a program group called
Turbo C++ 4.5. Open this group to reveal the icons for the C++ IDE (labeled Turbo C++)
and the other programming tools that ship with Turbo C++.
When you double-click the Turbo C++ icon, the IDE opens. Inside the IDE, you’ll find
all the tools you’ll need to create C++ programs. Along with windows for the editor,
browser, and debugger, the IDE contains windows for project files and compiler and
programming tool messages. Figure 1.1 shows how the IDE might look after compiling
a simple Windows project.

Chapter 1, Getting started 7


Figure 1.1 The Turbo C++ IDE

Menu Bar

SpeedBar

Edit
window

Message
window

Project
window

Status Bar

The IDE menu system


Table 1.1 describes the menus on the IDE menu bar.
Table 1.1 The IDE menus
Menu item Command descriptions
File Commands to open, save, and print files. Also includes the IDE exit command.
Edit Clipboard commands and commands for undoing and redoing program edits.
Search Commands for searching and replacing strings, browsing symbols, locating functions,
and reviewing error messages generated by the programming tools.
View Commands to open the ClassExpert, Project Manager, Message window, and Browser.
Also contains commands to open the various integrated debugger windows.
Project Commands to open, close, and compile projects. Also contains the AppExpert
command.
Debug Commands to run your project under control of the integrated debugger.
Tool Commands to launch programming tools from the IDE, including Turbo Debugger.
Options IDE customization and project configuration commands.
Window IDE window management commands.
Help Commands to access the Turbo C++ online Help system.

8 User’s Guide
The IDE SpeedBar
The SpeedBar (located under the main menu) has buttons that give quick access to
menu commands which relate to the area of the IDE you’re working in. For example, if
you’re editing code, the SpeedBar contains cut and paste commands, file save
commands, and so on. When the Project window has focus, the SpeedBar has buttons
that pertain to projects, such as commands for adding project nodes and browsing
option settings.
The Status Bar at the bottom of the IDE contains “flyby” help hints; when the cursor is
over a button, the Status Bar describes the button command. You can configure the flyby
hints and other SpeedBar options, as described in “Customizing the SpeedBars” on
page 16.

Using SpeedMenus in the IDE


Right-clicking (clicking the right mouse button) accesses the Turbo C++ SpeedMenus.
SpeedMenus contain commands that are context-sensitive to the area of the program
you’re working in. For example, the SpeedMenu for the Edit window contains
commands that are related to the editor. In the Project Manager, the SpeedMenus
contain commands to help you with managing your projects.
To get a feeling for SpeedMenus, try the following:
1 From the IDE, choose Project|Open, then open the project file MULTITRG.IDE in the
\TCWIN45\EXAMPLES\IDE\MULTITRG directory.
2 Double-click the MULTITRG [.CPP] node to open the file in an Edit window.
3 Move the cursor to the string.h header file reference by clicking on the file name in
the source code.
4 Right click to open the Edit window SpeedMenu, then choose Open Source to open
an Edit window that contains this header file.
Note In addition to right-clicking, the IDE speedmenus can be accessed at any time by
pressing Alt+F10.

Using the Edit window


Edit windows contain the Turbo C++ editor, which you can use to create and edit your
program code. When you’re editing a file, the IDE status bar displays the following
information about the file you’re editing:
• The line number and character position of the cursor. For example, if the cursor is on
the first line and first character of an Edit window, you’ll see 1:1 in the status bar; if
the cursor is on line 68 and character 23, you’ll see 68:23.
• The edit mode: insert or overwrite. Press Insert to toggle whether your text additions
overwrite existing characters or insert new ones into the file.

Chapter 1, Getting started 9


• The file’s save status. The word Modified appears if you’ve made changes to the file
in the active Edit window, and you have not yet saved your edits or changes.
Note The Turbo C++ editor contains many powerful features to help you enter and modify
your program code. For example, you can undo multiple edits by choosing Edit|Undo
or pressing Alt+Backspace. You can also open multiple Edit windows; tile the windows as
you wish; subdivide the window into different Edit panes; and cut, copy, and paste text
between any open files.
Although this chapter provides a brief introduction to the editor, complete details on
how to use and customize the editor can be found in the online Help that accompanies
the IDE. Choose Help|Contents, then click Integrated Development Environment for a
list of topics that relate to the IDE. From here, view the Editor topic, and the Menu
Commands topics Edit Menu and Search Menu.

Creating a new file


To introduce you to the editor, step through the following instructions to create an
EasyWin program that’s used as an example later in this chapter.
1 Create the directory \MYSOURCE using File Manager (you’ll use this directory to
hold the project files you create later in this chapter).
2 From the IDE, choose File|New to open a new Edit window with an empty file.
By default, Turbo C++ names new files NONAMExx.CPP, where xx is a number
that’s incremented with each new file opened.
3 In the Edit window, type the following C++ code to create an EasyWin program:
#include <iostream.h>

int main (void)


{
cout << "Welcome to the World of Windows!\n"; //print text
return(0);
}
4 Choose File|Save As, and save your new file in the \MYSOURCE directory with the
file name EZW_TEST.CPP (this file is used later in this chapter).

Working with simple projects


After you first install Turbo C++, you’ll want to make sure the program is correctly
setup; the details of the compiler and the IDE can wait until later. The best way to test
your setup is to compile a few sample programs.
In this section, you’ll learn how to create and run two simple programs. The first
program is an EasyWin program. (For more information about EasyWin, see Appendix
A.) After creating the EasyWin program, you’ll be taken through the steps to create a 16-
bit Windows program.

10 User’s Guide
Creating an EasyWin Program
You can become familiar with the Project Manager and the C++ compiler by following
these steps to create a simple EasyWin program:
1 From the IDE, choose Project|New Project, then set the following options in the New
Target dialog box:
• Type the path and name for your new project into the Project Path And Name
input box. In this case, type:
\mysource\ezw_test.ide
Note If the directory doesn’t exist, the IDE creates the directory for you.
• In the Target Type list box, click EasyWin [.EXE]. This selection creates a Windows
program from a program that uses character-mode input and output. (For more
information on EasyWin, refer to Appendix A, “Using EasyWin.”)
The New Target dialog box should now resemble the one shown in Figure 1.2.
Figure 1.2 The New Target dialog box

2 Choose OK to close the New Target dialog box. The Project window opens and
displays the target and dependencies of the project you just created.
Notice that one of the nodes in the project points to the file EZW_TEST.CPP, the file
you created earlier in the chapter (if you haven’t already done so, create this file by
following the instructions listed in the previous section “Creating a new file”).
3 Because the .DEF and .RD files are unnecessary for this project, you must delete the
.DEF and .RC nodes created by the Project Manager:
1 Select the EZW_TEST [.DEF], then press Ctrl and select EZW_TEST [.RC].
2 From the Project Manager SpeedMenu (press the right mouse button), choose
Delete Node, then choose Yes to confirm your request to delete 2 project nodes.

Chapter 1, Getting started 11


4 Compile and run the program by double-clicking the EZW_TEST [.EXE] project
node.
If you correctly followed all the steps in this section, the program builds without errors
and then runs in a window. If the compiler reports errors or warnings during the
compile, retrace the steps in this section to ensure you correctly followed the steps.
When the program compiles without errors, the Project Manager creates an executable
program called EZW_TEST.EXE and places it in the \MYSOURCE directory.

Creating a Windows program


This section demonstrates how to compile a simple Windows program.
If you followed the steps in the preceding section to create an EasyWin program, you’ll
find that most of the steps for creating this Windows program are identical to those
listed for the EasyWin program. When you’re finished with this example, the tasks
involved with creating and compiling simple programs with the IDE should be familiar:
1 Create a new project.
2 Set the target options using the New Target dialog box.
3 Add code to the appropriate nodes in the project.
4 Compile and run the project.
Indeed, most projects will require more involved steps, but the basic steps for creating
and compiling projects remains the same. With this in mind, follow these steps to create
a simple Windows program:
1 Choose Project|New Project to open the New Target dialog box, then make the
following settings:
• Type the following path and name for your new project in the Project Path And
Name input box:
\mysource\win_test.ide
Note If the directory doesn’t exist, the IDE creates the directory for you.
• In the Target Type list box, click Application [.EXE] to set the type of program you
plan to create (this is the default setting).
• In the Platform combo box, set the Target Type to Windows 3.x (16).
2 Click the Advanced button, then uncheck both the .RC and .DEF options in the dialog
box that appears. Unchecking these settings tells the Project Manager that this project
doesn’t use definition and resource files, as most Windows programs do.
3 Choose OK to accept the settings, then choose OK again to close the New Target
dialog box. The Project window opens with your new project.
4 In the Project window, double-click the win_test [.cpp] node to open an empty file in
the Edit window.
5 In the Edit window, type the following code to create a Windows program, then save
the program by choosing File|Save.

12 User’s Guide
#include <windows.h>
int PASCAL WinMain(HINSTANCE hCurInstance, HINSTANCE hPrevInstance,
LPSTR lpCmdLine, int nCmdShow)
{
MessageBox(NULL, "Welcome to the World of Windows!", "A Windows Program",
MB_OK | MB_ICONEXCLAMATION );
return(0);
}
6 Choose Project|Build All to compile this program, then choose OK after the
compilation is finished. If you followed the steps correctly, you can arrange the
windows so the IDE resembles the screen shown in Figure 1.1 on page 8.
When you build this project, the compiler produces several warnings, but it still
creates an .EXE file in the \MYSOURCE directory. Even though a program that
compiles with warnings can still be executed, it’s not a good idea to ignore the
warnings without first understanding why the compiler complained.
The first warnings that appear indicate that the parameters in WinMain are never
used in the program. In this small program, it is safe to ignore these warnings. The
last warning indicates that the default module-definition settings are being used; this
is expected since we didn’t create a module-definition (.DEF) file.
7 To run the program from the IDE, choose Debug|Run.
When you run this program, a small dialog box with the text “Welcome to the World of
Windows!” appears. To terminate the program and return to the IDE, choose OK.

Single file programs


Usually when you begin to write a new program, you start by creating a new project for
that program. Although it’s possible to compile a single-source file program without
using a project, it’s usually easier to maintain the program settings through a project file.
However, if you want to set target options for a single-source file program without
creating a project,
1 Choose Project|Close Project to make sure you don’t have a project file open.
2 Choose File|Open, then open the source file containing your program.
3 Open the TargetExpert by right-clicking in the Edit window and choosing
TargetExpert from the SpeedMenu.
4 Adjust the target settings for your single-source file program using the TargetExpert
dialog box, as described in “Editing target attributes using TargetExpert” on page 26.
5 Choose Options|Project from the menu, and set the project options, as described in
Chapter 3.
6 Choose Project|Compile (this command compiles the code in the current Edit
window if no project is loaded).

Chapter 1, Getting started 13


Customizing the IDE
You can configure the IDE in many ways to create a customized environment that meets
your programming needs. For example, you can have the IDE do tasks automatically
(such as saving backups of your files in the Editor windows) or handle special events.
The Environment Options dialog box (accessed with the Options|Environment
command) lets you configure the different elements and windows of the IDE. Once
you’ve customized the IDE to your liking, choose Options|Save, check the options you
want to save, then choose OK; the IDE saves your environment settings to a file called
TCCONFIG.TCW. By default, the file is saved to the BIN directory in your Turbo C++
directory tree. This default directory is specified by the DefaultDesktopDir field of your
TCW.INI file, which is located in the your Windows directory.
The Environment Options dialog box displays a list of customizable topics on the left
and each topic’s configurable options on the right. Some topics contain subtopics,
indicated by a + next to the topic. For example, the Editor topic has subtopics called
Options, File, and Display. To view a topic’s subtopics, click the + sign next to the topic;
its subtopics appear under it and the + turns to a – (you can then click the – to collapse
the list of subtopics). Topics without subtopics appear with a dot next to their name.
Figure 1.3 The Environment Options dialog box

This chapter discusses the following Environment Options topics:


• Configuring the IDE editor
• Syntax highlighting
• Customizing the SpeedBars
• Setting IDE preferences
• Saving your IDE settings
Note Although this chapter doesn’t offer a complete reference to the Environment Options
dialog box, a complete reference is available by clicking the Help button in the
Environment Options dialog box.

14 User’s Guide
Configuring the IDE editor
You can configure the editor so that it looks and behaves like other editors such as Brief
and Epsilon. The IDE editor uses keyboard mapping files (.CKB files) that set the
keyboard shortcuts for the editor and the other windows in the IDE. A complete
reference to the keyboard mapping files is available in the online Help (choose Help|
Keyboard).
You can use one of the four .CKB files provided with Turbo C++ by choosing Options|
Environment|Editor, then clicking a SpeedSetting (Default keymapping, IDE classic,
BRIEF emulation, or Epsilon emulation). To learn how to edit or create your own .CKB
file, refer to the online Help and search on “Keymapper.” You can also customize the
editor script files (.KB files), which are found in the directory \TCWIN45\SOURCE\
KEYBOARD.
Note All keymappings shown in this manual reflect the default Turbo C++ keymappings. If
you install a different keyboard mapping (such as BRIEF.CBK), the shortcuts shown in
this manual will not be the same as those installed on your system.

Syntax highlighting
Syntax highlighting lets you define a color and font attribute (such as bold) for certain
elements of code. For example, you could display comments in blue and strings in red.
Syntax highlighting is on by default.
Syntax highlighting works on files whose extensions are listed in the Syntax Extensions
list (by default, these files are .CPP, .C, .H, .HPP, .RH and .RC). You can add or delete
any extension from this list, but be sure to separate extensions with semicolons.
The Syntax Highlighting section displays the default color scheme and four predefined
color settings. To use a predefined color scheme,
1 Choose Options|Environment|Syntax Highlighting.
2 Choose one of the four color predefined schemes (Defaults, Classic, Twilight, or
Ocean) by choosing the Color SpeedSetting; the sample code changes to the color
scheme you select.
To customize the syntax highlighting colors,
1 Choose Options|Environment, then select the Syntax Highlighting topic.
2 Select a predefined color scheme to use as a base for your customized colors.
3 Choose the Customize topic listed under the Syntax Highlighting topic. Elements
and sample code appear on the right of the Environment Options dialog box.
4 Select an element you want to modify from the list of elements (for example, choose
Comment), or click the element in the sample code (this selects the name in the
Element list). You might need to scroll the sample code to view more elements.
5 Select a color for the element. The element color in the sample code reflects your
selection. Use the left mouse button to select a foreground color for the element (FG
appears in the color). Use the right mouse button to select a background color (BG

Chapter 1, Getting started 15


appears in the color). If FB appears in the color, the color is used as both a
background and a foreground color.
6 If you want, choose an Attribute (for example, bold).
7 You can check Default FG (foreground) or BG (background) to use the Windows
default colors for an element.
8 Repeat steps 2–4 for the elements you want to modify.
To turn off syntax highlighting, Choose Options|Environment|Syntax Highlighting,
then uncheck Use Syntax Highlighting.

Customizing the SpeedBars


The IDE has context sensitive SpeedBars for all its windows, including the Edit,
Browser, Debugger, Project Manager, Message, Desktop, and ClassExpert windows.
When a window has focus, the corresponding SpeedBar appears. Using the
Environment Options dialog box, you can customize each of the SpeedBars so that they
include only the buttons you want.
To add or delete buttons from the SpeedBars,
1 Choose Options|Environment from the IDE’s main menu.
2 Choose the SpeedBar topic on the left. The right side of the dialog box displays
general options for all SpeedBars.
The options here let you specify if you want to hide or view the SpeedBar, where you
want the SpeedBar to appear (on the top or bottom of the IDE), and if you want to use
the Flyby Help Hints. If you check Use Flyby Help Hints, the IDE displays
descriptions of the SpeedButtons on the status line when you pass the mouse pointer
over a button. If you leave this box unchecked, the hints show on the status line only
when you click a SpeedButton.
3 Choose the Customize topic listed under the SpeedBar topic to customize the
SpeedBar for a particular window.
4 In the Window combo box, choose the specific window (Editor, Browser, Debugger,
Project, Message, IDE Desktop, or ClassExpert) whose SpeedBar you want to
customize.
The Available Buttons list box displays all the available (unused) buttons that you
can add to a particular window’s SpeedBar. (Each button has a name next to it that
describes the button’s function.) The Active Buttons list box displays the buttons that
are currently contained in the selected window’s SpeedBar.
• To add a button to a SpeedBar, double-click the button icon in the Available Buttons
list, or select it and click the right-pointing arrow. The IDE places the button in
front of the selected button in the Active Buttons list.
• To remove a button from a SpeedBar, double-click the button icon in the Active
Buttons list, or select it and click the left-pointing arrow. The button moves to the
Available Buttons list.

16 User’s Guide
• To reorder the button positions for a SpeedBar, select a button in the Active Buttons
list, and use the up and down arrows to move the button within the list (the top
button in the list appears on the left side of the SpeedBar; the last button in the list
appears on the right side of the SpeedBar).
• To put separator spaces between buttons on the SpeedBar, select a button from the
Active Buttons list then click the Separator button. The separator is added before
the selected button.
You can also make all SpeedBars identical by selecting a SpeedBar in the Window list,
then pressing the Copy Layout button. A dialog box appears in which you check all the
SpeedBars you want to make identical to the selected SpeedBar. For example, if you first
choose the Editor SpeedBar, then click Copy Layout, the dialog box appears with Editor
dimmed. If you then check Project and Message, those SpeedBars will be exactly the
same as the Editor SpeedBar.
You can restore any SpeedBar to its original defaults by selecting the SpeedBar in the
Window list then clicking the Restore Layout button.

Setting IDE preferences


The Preferences command lets you customize what IDE settings you want
automatically saved and how you want some IDE windows to work.
To set preferences,
1 Choose Options|Environment|Preferences.
2 Check and uncheck the options you want, then choose OK. For an explanation of
each option, see the online Help (press the Help button).

Saving your IDE settings


The IDE automatically saves information when you exit the IDE, run the integrated
debugger, or close or open a project. You can control which areas of the IDE get saved
from the Preferences topic in the Environment Options dialog box (choose Options|
Environment from the main menu).
If you want to save your settings manually, you can do so as follows:
1 Choose Options|Save.
2 Check Environment to save the settings from the Editor, Syntax Highlighting,
SpeedBar, Browser, and Preferences sections of the Environment Options dialog box.
These settings are saved in a file called TCCONFIG.TCW.
3 Check Desktop to save information about open windows and their positions. This
information is saved to a file called <prjname>.DSW. If you don’t have a project open,
the information is saved to a file called TCWDEF.DSW.
4 Check Project to save changes to your project (.IDE) file, including build options and
node attributes.

Chapter 1, Getting started 17


Running other programs from the IDE
By default, the IDE lists Resource Workshop, GREP, WinSight, WinSpector, and Key
Map Compiler on the Tool menu. To run any of these tools from the IDE, choose Tool|
ProgramName, where ProgramName is the name of the program you want to run (for
example, Tool|GREP runs the GREP utility).
You can run any executable program or utility without leaving the IDE by adding it to
the Tool menu. For a complete discussion on adding items to the Tool menu, see
“Adding translators, viewers, and tools to the IDE” on page 31.

18 User’s Guide
Chapter

Creating and managing projects


Chapter 2
2
The Turbo C++ IDE contains a Project Manager that gives you a visual representation of
the files contained in your project. With the Project Manager, you can see exactly what
files you’re building, the files you’re using in the builds, and the options that you’ve set
for the builds.
This chapter covers the following topics, which describe how to use the Project Manager
to organize the files in your project:
• Project management
• Using the Project Manager
• Grouping sets of files with Source Pools
• Translators, viewers, and tools
For information on setting project options and compiling, see Chapter 3.

What is project management?


As your applications grow in size and complexity, you’ll discover that your programs
become more and more dependent on different intermediate files. In addition, you’ll
find that some of the modules in your project must be compiled with different compilers
or different compiler options. A Windows program, for example, can be composed of
resource scripts, import libraries, and source code, with each different file type requiring
a different compiler and compiler settings.
As the complexity of your projects increase, the need increases for a way to manage the
different components of your projects. By studying the files that make up a project, you
can see how a project combines different source files to produce different target files.
Target files, for example, can be .DLL or .EXE files. The source files that these targets are
dependent upon can consist of files like .C, .CPP, and .H files. Project management is the
organization and management of the sources and targets that make up your project.

Chapter 2, Creating and managing projects 19


Using the Project Manager
The Project Manager visually organizes all the files in your project using a Project Tree.
The Project Tree displays files in a hierarchy diagram. Each level of the hierarchy
contains a single target and all the target’s dependencies. To show their relationship to
the target, dependencies are indented below the target listing. Figure 2.1 shows how the
Project window displays a Project Tree. To expand and collapse the hierarchy tree, click
nodes containing the + and – symbols.
Figure 2.1 The Project window displaying a Project Tree
Project node
Target node
Source node
Autodependency nodes

Run-time nodes

The Project Manager uses the following types of nodes to distinguish the different types
of files in your project:
• The project node, located at the top of the Project Tree, represents the entire project. All
the files used to build that project appear under the project node. By default, the
project node is not displayed in the Project Tree. To display the project node, choose
Options|Environment and select Project View from the list of Topics, then check
Show Project Node.
• A target node represents a file that is created when its dependent nodes are built (a
target is usually an .EXE, .DLL, or .LIB file that you’re creating from source code). A
project can contain many target nodes. For example, in a single project, you might
build an executable file and two separate DLL files, making three targets in all.
• Source nodes refer to the files that are used to build a target. Files such as .C, .CPP, and
.RC are typical source nodes.
• A run-time node refers to files that the Project Manager uses during the linking stage of
your project, such as startup code and .LIB files. The Project Manager adds different
run-time nodes, depending on the options you specify in TargetExpert. By default,
run-time nodes are not displayed by the Project Manager. To view run-time nodes,
choose Options|Environment|Project View, then check Show Runtime Nodes.
• Autodependency nodes are the files that your program automatically references, such as
included header files. By viewing autodependency nodes, you can see the files that
source nodes are dependent upon, and you can easily navigate to these files from the
Project Manager. By default, autodependency nodes are not displayed in the Project
Manager. To view autodependency nodes, choose Options|Project|Make, then
check Autodependencies: Cache & Display. Note that you must build the project
before the Project Manager can display autodependency information.
The Project Manager uses the following color scheme for its nodes:

20 User’s Guide
• Blue nodes are those that were added by the programmer.
• White nodes indicate project targets.
• Yellow nodes are those that were added programmatically by the compiler (when it
posts dependencies and Autodependencies), by AppExpert or ClassExpert (when
they add .CPP nodes), or by TargetExpert (when it adds nodes based on the target
type).
The Project Manager uses special glyphs in the left margin to indicate the build attributes
of project nodes. To apply build attributes to a node (and for a reference on the different
Project Manager glyphs), choose Edit Local Options from the Project Manager
SpeedMenu, then select the Build Attributes topic.
In addition to helping you organize your project files, you can use the Project Manager
to access source files and build targets.
• To bring a source file into an Edit window, double-click the node in the Project Tree,
or highlight the node and either press Enter or choose View|Text Edit from the
Project Manager SpeedMenu.
• Using the Project Manager to make a project is very effective because you can use the
Project Manager to translate only the files that have changed since the last project
build; computer resources are not wasted on unnecessary file updates. (The term
“translate” refers to using one file type to create another. For example, the C++
compiler is a translator because it generates .OBJ files from .CPP files. For more
information on translators, see page 30.)
There are several ways to customize the build options of the nodes in your project.
Maintaining project options and compiling project targets is described in detail in the
next chapter, “Specifying project options and compiling.”

Creating a project
When you begin to write a new application, the first step is to create a new project to
organize your application’s files. The command Project|New Project opens the New
Target dialog box, which is shown in Figure 1.2 on page 11.

Setting target options with the New Target dialog box


When you create a new project, the IDE automatically assigns default file names to the
nodes in your project. The following steps show how to change these default settings
and how to complete the initial project setup.
1 Type the path and name for the new project into the Project Path And Name input
box (the project name must contain eight characters or less). Note that you don’t have
to type a file extension because the IDE automatically assigns the extension .IDE to all
project files.
2 In the Target Name input box, type the name for the first target in your project. This
is usually the name of the .EXE or .DLL file that you want to create.

Chapter 2, Creating and managing projects 21


Note The remaining fields in the New Target dialog box set the options for the first target
in the project. These fields are commonly referred to as the TargetExpert, since these
are the fields contained in the TargetExpert dialog box, as shown in Figure 2.2.
Figure 2.2 TargetExpert dialog box

3 Choose the type of target you want to build using the Target Type list. For
information on the target types, see the online Help for the IDE. Information on using
the Help compiler can be found in the online Help file CWH.HLP.
4 Choose a platform for your target using the Platform drop-down list. Information for
the individual platform types can be found in online Help.
5 Select the memory model of the target from the Target Model options.
• Small uses different code and data segments, giving you near code and near data.
• Medium gives you near data and far code.
• Compact is the inverse of the Medium model, giving you near code and far data.
• Large gives you far code and far data.
The entries in the Target Model list adjust according to the Platform type you’ve
selected.
6 Using the Standard Libraries group, choose the types of libraries to use with your
application (depending on your platform and target choices, some of these libraries
might not be shown):
• OWL uses the ObjectWindows libraries. See the ObjectWindows Programmer’s
Guide for more information.
• OCF uses the ObjectComponents OCOLE.DLL support library (a framework that
encapsulates OLE 2). See the ObjectWindows Programmer’s Guide for information.
• Class Library uses the Turbo C++ container class libraries discussed in the
Programmer’s Guide and the Library Reference.
• Runtime uses the standard C/C++ function libraries listed in the Library Reference.
• BWCC uses the Borland Windows Custom Control libraries. See Chapter 10 for
details.
• OLE 2 links the libraries that support OLE 2.

22 User’s Guide
For Windows applications, you can choose the following type of linking methods:
• Dynamic causes your application to bind to the standard libraries at runtime—
the functions in the standard libraries are located in a separate .DLL rather than
directly attached to your application. This greatly reduces the size of an
application, but the target is then dependent on the presence of the .DLLs at
runtime.
• Static binds the standard library functions directly to your executable file, creating
a larger, standalone executable. If you’re building many DLLs with statically
bound RTLs, each DLL gets its own copy of the routines it uses.
The following library choice applies to a very specific build situation:
• Diagnostic uses a diagnostic version of the libraries, which have debug and
diagnostic information added to the files. This option is available for only Class
Libraries and ObjectWindows.
Note Some libraries are automatically checked when you choose a target type (you can’t
uncheck some of these because they are required for the type of target you’re
creating). If dynamic and static libraries exist, you can choose which type of library
you want to use (in this case Dynamic is usually the default library type).
7 If needed, click the Advanced button to specify the types of source nodes created
with your new target (this procedure is described in the following section).
8 Click OK to accept the settings and close the New Target dialog box. The Project
Manager creates the project file, which is denoted with an .IDE extension.
When you close the New Target dialog box, the Project Manager draws a graphical
representation of your project in the Project window. The Project Manager creates a
target node with one or more source nodes below with the project node. After creating
the initial target for a project, you can add, delete, or modify the nodes in your project, as
described in the following sections.

Specifying the source node types


The Advanced button in the New Target dialog box opens the Advanced Options dialog
box. Use this dialog box to set the types of source nodes that the IDE creates with a new
target node.
• .CPP Node creates a C++ source node.
• .C Node creates a C language source node.
• No Source Node creates a target node that doesn’t use a source node. Use this option
when you do not want to create a source node that uses the same file name as the
name of the project. When you create a new target with this option, you must
specifically add the source node, as described in “Adding source nodes to your
project” on page 24.
If your program is a Windows program, check the following boxes according to the files
your target uses.
• .RC creates a source node that is associated with a resource script.
• .DEF creates a source node that’s associated with a Windows definition file.

Chapter 2, Creating and managing projects 23


Opening existing projects
To open an existing project, choose Project|Open Project, then use the file browser to
select an existing .IDE or .PRJ project file (.PRJ files are converted to .IDE files when you
save the project). If the project opens, but the Project window is not visible, choose
View|Project to access the Project window.

Adding source nodes to your project


To add a source node to a project,
1 Select any node in the Project Tree under which you want the new node to appear.
For example, if you want the new node to appear under the target, select the target
node.
2 Press Ins, click the button on the SpeedBar, or right-click the node to open the Project
window SpeedMenu, then choose Add Node.
3 Using the file browser, choose the file or files you want associated with the new node.
Alternatively, you can type the name of the file you want to add.
4 Choose OK to confirm your settings.
You can use the Windows File Manager to add one or more source nodes.
1 Open the File Manager and arrange the windows so you can still view the Project
window in the IDE.
2 In the File Manager, press Ctrl and select the files you want to add as source nodes.
3 Drag the files from the File Manager and drop them on a node in the Project window.
The Project Manager automatically adds the source files under the selected node.

Deleting source nodes


To delete a node in a project, select the node and press Del, or choose Delete Node from
the SpeedMenu. To delete many nodes, select the ones you want to delete (press Ctrl or
Shift and click the left mouse button to select multiple nodes), then press Del. The Project
Manager asks if you want to delete the nodes before it proceeds.

Editing source node attributes


Node attributes describe the node and define the tool that translates it (if applicable). To
edit the attributes of a source node,
1 Right-click the source node (or select the node and press Alt+F10), then choose Edit
Node Attributes from the SpeedMenu. The Node Attributes dialog box appears.
2 Update the node attributes, then choose OK to confirm your settings.
Node attributes are defined as follows:
• Name is the file name of the node, without a file extension.
• Description is an optional text description of the node.

24 User’s Guide
• Style Sheet is the name of the Style Sheet the Project Manager uses when it
translates that node. If <<None>> is specified, the Project Manager uses the option
settings in the parent’s Style Sheet. For more information on Style Sheets, see the
next chapter, “Specifying project options and compiling.”
• Translator names the translator used on that node. The IDE assigns a default
translator for the node type (for example, CppCompile for a .CPP node), which
can be overridden using this field. See “Translators, viewers, and tools” on page 30
for more information on translators.
• Node type defines the node extension, which in turn defines the available
translators for that node.

Adding target nodes to your project


To add a target to a project with the New Target dialog box,
1 Choose Project|New Target, or click the button on the SpeedBar.
2 Type the name for the new target, then choose one of the following target types:
• Standard (default) can be an executable, DLL, or other file.
• AppExpert is an automatically generated ObjectWindows-based application. See
Chapter 4 for more information on this type of target.
• Source Pool is a collection of files that can be referenced in other targets. See page
29 for more information on using Source Pools.
3 Choose OK. If the target type is Standard, the TargetExpert dialog box appears (as
shown on page 22) so you can further define your target. If the target type is
SourcePool, the target is added to the project and you can add nodes to it
immediately, as described on page 29. If you choose AppExpert as the target,
AppExpert appears.
When you add a new target, it is always appended to the end of the Project Tree.
To view a sample project with two targets, open the MULTITRG.IDE project in the
\TCWIN45\EXAMPLES\IDE\MULTITRG directory. This project file builds two
versions of the WHELLO program—one with debug information and one without. The
project file contains a text file that describes how to use two or more targets in a project.
With more than one target in a project, you can choose to build a single target, multiple
targets, or the whole project. For more information, see “Compiling projects” on
page 41.

Deleting target nodes


To delete a target node:
1 Right-click the target node you want to delete (or highlight it and press Alt+F10).
2 Choose Delete Node from the SpeedMenu.
3 The Project Manager asks if you’re sure you want to delete the target. Choose OK to
delete the target and all its dependencies from the project.

Chapter 2, Creating and managing projects 25


You can also delete several nodes by pressing Ctrl and clicking the nodes you want to
delete, then press Del.
Warning! Use care when deleting target nodes—you cannot undo the deletion.

Editing target attributes using TargetExpert


Target attributes describe the target. Using TargetExpert (shown in
Figure 2.2 on page 22), you can modify the attributes for Standard and AppExpert
target types. However, you can’t change target attributes for Source Pools.
To change a target’s attributes,
1 In the Project window, right-click the target node (or select it and press Alt+F10), then
choose TargetExpert from the SpeedMenu to open the TargetExpert dialog box.
Or choose Options|Target, select the target, and choose the Edit button.
Note The TargetExpert fields are a subset of the fields in the New Target dialog box. For a
description of these fields, refer to “Setting target options with the New Target dialog
box” on page 21.
2 Update the target attributes, then choose OK to confirm your new settings.

Moving nodes within a project


You can move nodes within a project in the following ways:
• By dragging the node to its new location.
• By selecting the node and press Alt and the arrow keys. This moves the selected node
up or down through the visible nodes. You can also use Alt and the right and left
arrow keys to promote and demote nodes through levels of dependencies. For
example, if you have a .CPP file dependent that’s on a header file (the .H file appears
under and right of the .CPP in the project window), you can move the header file to
the same level as the .CPP file by selecting the header file and pressing Alt ←.

Copying nodes in a project


You can copy nodes in your project file either by value or by reference. When you copy
a node by value, the Project Manager places an identical, but separate, copy of the node
in the location you specify. The nodes you copy inherit all the attributes from the
original node and you have the ability to modify any of the copied node’s attributes.
When you copy by reference, you simply point to one node from a different location in
the project; a reference copy isn’t distinct from the original node. If you modify the
structure of the original node, the reference copy is also modified. However, a reference
copy does not inherit the options of the original node; you’re free to attach Style Sheets
and override options in the copied node without affecting the original node.
To copy a node by value,

26 User’s Guide
1 Select the node or nodes you want to copy (press Shift or Ctrl and click to select
multiple nodes). You don’t need to select the node’s dependents because they are
copied automatically.
2 Hold down the Ctrl key and drag the selected nodes to where you want to place the
complete copies.
3 When you release the mouse button, the copied nodes appear. At this point, you can
edit either the original or the copied nodes without changing other nodes in the
project.
To copy a node by reference,
1 Select the node you want to copy by reference. You don’t need to select the node’s
dependents because they are automatically copied by reference.
2 Hold down the Alt key and drag the selected node to where you want to place the
reference copy.
3 When you release the mouse button, the reference-copied node appears and is
displayed in a lighter font. This helps you remember that the node is copied by
reference rather than by value. If you edit the original node (such as adding or
deleting dependents), all referenced copies are updated.
Warning! You cannot add to, delete, or modify nodes that have been copied by reference; to
modify nodes copied by reference, you must edit the master copy. If you delete an
original node, all reference copies to that node are also deleted. You cannot undo this
deletion.

Importing projects from older versions of Turbo C++


The Project Manager can load projects from older versions of Turbo C++. Choose
Project|Open Project, then type the name of the .PRJ file. To display the old project files
in the file name list, change the search extensions from *.IDE to *.PRJ in the List Files Of
Type drop-down box.
When you open an old project file, the Project Manager converts the old project to a new
one. Be sure to save the new project if you want to keep using it with this version of
Turbo C++. To save the project, choose Options|Save. Make sure Project is checked,
then click OK. The new project is saved with an .IDE file extension.

Importing projects from Borland C++


When you attempt to load .IDE files created with Borland C++, a dialog box warns you
that the BC file may contain features that Turbo C++ does not support. To disable this
dialog box, add the following line to your TCW.INI file:
[Project]
ImportBorlandIDEFile=1
Warning! Some options supported in BC .IDE files do not transfer gracefully to Turbo C++. Only
16-bit Windows and EasyWin targets will build successfully under Turbo C++. Other

Chapter 2, Creating and managing projects 27


targets, such as DOS and Win32, will produce build failures. If you open TargetExpert,
it will forcibly reassign any target types it does not recognize.
Any compiler optimization switches set in the original BC project are simply ignored.
They remain set, however, so if you return the project to BC the optimizations still work.
Any compiler and linker options not available in TCW are not visible in the options
dialogs. In this category are 8086 and 80286 CPU support, tiny and huge memory
models, entry/exit code options for DOS targets, some prolog/epilog options, and the
target Windows version for Win32 resources. If you import project files with
unsupported options, you should open the options dialog and choose supported
settings.

Customizing the Project window


By default, the Project window displays target nodes and source nodes. To control the
display of nodes and options,
1 Choose Options|Environment to open the Environment Options dialog box, then
choose Project View. The right side of the dialog box displays the Project View
options.
Figure 2.3 The Environment Options dialog box

2 Check or uncheck the options you want. A sample node called WHELLO changes as
you select or deselect options. This sample shows you how all nodes appear in the
Project window.
• Build translator displays the translator used on the node.
• Code size displays the total size of code segments in bytes. This information
appears only after the node has been compiled.
• Data size displays the size of the data segment in bytes. This information appears
only after the node has been compiled.
• Description displays an optional description of the node in the Project Tree. Type
the description using the Edit Node Attributes dialog box available from the
Project Manager SpeedMenu.

28 User’s Guide
• Location lists the path to the source file associated with the node.
• Name displays the name of the node.
• Number of lines displays the number of lines of code in the file associated with
the node (note that this appears only after you compile the code).
• Node type describes the type of node (for example, .cpp or .c).
• Style Sheet names the Style Sheet attached with the node.
• Output names the path and file name that’s created when the node is translated.
For example, a .CPP node creates an .OBJ file.
• Show runtime nodes displays the nodes the Project Manager uses when the
project is built. For example, it lists startup code and libraries.
• Show project node displays the project node, of which all targets are dependents.
3 Click OK to close the Environment Options dialog box.
4 To save your project customizations, choose Options|Save, then check Project. Note
that you can save different option sets with the different projects you work on.

Grouping sets of files with Source Pools


A Source Pool is a collection of source nodes that can be referenced by multiple target
nodes. When a Source Pool is referenced by a target node, the nodes in the Source Pool
take on the options and target attributes of the target. Because Source Pools let you
create different targets using a common set of source nodes, it’s easy to maintain the files
that the targets use. When you add or delete a file from the Source Pool, you don’t have
to worry about updating all your target nodes; they’re updated automatically through
the reference to the Source Pool.
You can also use Source Pools when you have several header files that you need to
include throughout your project. If you place the header files in a Source Pool, you can
reference them wherever you need them in your project. Then, you only have to update
the original Source Pool when you need to make changes to the group of header files; if
you add a new header file to the Source Pool, all the referenced copies are automatically
updated.
Source Pools are also useful when you want to assign a single Style Sheet to multiple
nodes. For example, if three targets in a project need to use the same Style Sheet, you can
reference a Source Pool that contains the Style Sheet instead of attaching the same Style
Sheet to each individual node. Then, if you need to update the Style Sheet (for example,
if you want change from compiling with debug information to compiling without it),
you can update all the targets by modifying the single Style Sheet. You can also use
Source Pools to apply custom tools to project nodes. For more information, see the
example project \TCWIN45\EXAMPLES\IDE\DELIVER.

Creating a Source Pool


When you create a Source Pool, you create a target node with a group of nodes under it.
However, the target node of the Source Pool cannot be compiled—to compile the nodes

Chapter 2, Creating and managing projects 29


in a Source Pool, you must copy the Source Pool to another target node. Source Pools
work to your best advantage when you copy them by reference.
1 In your project, create a new target node by choosing Project|New Target.
2 Type the name of the Source Pool in Target Name.
3 Select SourcePool from the Type list, then press OK to create a Source Pool target
node in your project.
4 Select the Source Pool node in the Project Tree, and press Ins to open the Add To
Project List dialog box.
5 Select the source files you want, then press OK to add them to the Source Pool.
6 Copy the Source Pool by reference by holding down Alt and dragging the Source Pool
to the target nodes you want.
Note To see a working example of Source Pools, open the sample project called
SRCPOOL.IDE in the \TCWIN45\EXAMPLES\IDE\SRCPOOL directory. The project
file includes a text file that describes how the Source Pool is used in the example.

Translators, viewers, and tools


Translators, viewers, and tools are internal and external programs that are available to
you through the IDE.
• Translators are programs that create one file type from another. For example, the C++
compiler is a translator that creates .OBJ files from .CPP files; the linker is a translator
that creates .EXE files from .OBJ, .LIB, .DEF, and .RES files.
• Viewers are programs that let you examine the contents of a selected node. For
example, an editor is a viewer that lets you examine the source code of a .CPP file.
Resource Workshop is a viewer for Windows resource files.
• Tools are programs that help you create and test your applications. WinSight and
GREP are examples of programming tools.
The IDE associates each node in a project with different translators or viewers,
depending on the file extension of the node. Although each node can be associated with
several different translators or viewers, each node is associated with a single default
translator or viewer. This is how the IDE knows to open the Edit window when you
double-click a .CPP node (double-clicking a node invokes the default viewer on the
node). To see the default node type (determined by file extension) for a specific
translator or viewer:

30 User’s Guide
1 Choose Options|Tools to open the Tools dialog box.
Figure 2.4 The Tools dialog box

2 Select the item you want to inspect from the Tools list.
3 Choose Edit to access the Tools Options dialog box.
4 Choose Advanced to access the Tool Advanced Options dialog box, then inspect the
Default For text box.
When you right-click a node, you’ll find that some source nodes have a Special
command on the SpeedMenu. This command lists the alternative translators that are
available for the node type selected. For example, the commands C To Assembler, C++
To Assembler, and Preprocess appear on the Special menu of a .CPP node. The
command Implib appears if you selected a .DLL node. Using the Special command, you
can invoke any translator that is available for a selected node type. Also, by selecting a
source node in the Project Tree and choosing Edit Node Attributes from the
SpeedMenu, you can reassign the default translator for the selected node.

Adding translators, viewers, and tools to the IDE


The Tools dialog box displays the default set of translators, tools, and viewers. The
following steps show how to add an item to this list of programs.
1 Choose Options|Tools to access the Tools dialog box. This dialog box displays the
default list of translators, tools, and viewers.
2 Choose New to add a new program to the Tools list (to modify a program that’s
already listed, select the tool, then choose Edit).
3 Set the following options in the Tools Options dialog box:
• Name is a description of the item you’re adding. This is placed on the Tool list.
• Path is the path and executable program name. You can use the Browse button to
complete this selection.
• Command-line holds any command-line options, transfer macros, and IDE filters
you want to pass to the program. For information on transfer macros, refer to

Chapter 2, Creating and managing projects 31


online Help. (Try using $prompt if you want to experiment with transfer macros.)
IDE filters are .DLL files that let tools interface with the IDE (for example, the
GrepFile tool uses a filter to output text to the Message window). See the
FILTER.IDE project in \TCWIN45\EXAMPLES\IDE\FILTER for more
information on filters. To see transfer macros and filters in use, choose Options|
Tools, then select GrepFiles and choose Edit.
• Menu Text appears on SpeedMenus and on the Tools menu. If you want to assign
a shortcut key to your menu text, precede the shortcut letter with an ampersand—
this letter appears underlined in the menu. For example, &File assigns F as the
shortcut key for File. If you want an ampersand to appear in your menu text, use
two ampersands (&&Up&date appears as &Update in the menu).
Note You must supply Menu Text if you want the program item to appear on the
SpeedMenu or Tools menu.
• Help Hint is descriptive text that appears in the status line of the Tools dialog box
when you select the program item.
4 Open the Advanced Options dialog box (choose Advanced) to set the options for
your new program. Depending on the Tool Type you choose (Simple Transfer,
Translator, or Viewer), different fields become available. If you create a Translator,
the program becomes available for make and build processes.
• Place On Tools Menu adds the item to the Tool menu.
• Place On SpeedMenu adds a viewer or translator to the associated SpeedMenus.
• Target Translator, available for translators and viewers. For translators, this field
specifies whether the program produces a final target (such as an .EXE file) or an
intermediate file (such as an .OBJ or .I file). If you check this box, the translator
produces a final target that’s saved to the directory you specify in the Final text
box (choose Project|Options|Directories). If you don’t check Target Translator,
the translated file is saved in the directory you specify in the Intermediate text box.
For viewers, Target Translator specifies that the viewer works only on nodes that
have been translated (such as .OBJ or .EXE files); the node has to be translated
before you can view it.
• Translate From defines the node types (determined by file extension) that a
translator can translate. To specify multiple node types, use a semicolon to
separate file extensions.
When you enter a file extension in this field, the Project Manager adds the
translator to the Special menu of the project nodes that have that file extension.
When you choose Special from the Project Manager SpeedMenu, the Project
Manager displays all the available translators for that node type. However, it’s
important that each node type can have only a single, default translator (see the
description for Default For).
To see how this works, look at the tool CppCompile (choose Options|Tools,
double-click CppCompile, then click Advanced). The Tool Advanced Options
dialog box shows that the C++ compiler is a translator for .CPP, .C, .CAS, and .H

32 User’s Guide
files. If you have a source node with a .C extension, CppCompile appears on the
Special menu when you right-click the node and choose Special.
Figure 2.5 The Tool Advanced Options dialog box

• Translate To defines the extension of the file that the translator generates. For
example, HC31.EXE converts .HPJ files to .HLP, so HC31.EXE holds .hlp in this
field.
• Applies To is similar to the Translate From field, except that it’s used for Viewers
instead of translators.
• Default For changes the IDE’s default translator or viewer for the file types you
specify. Type the file extensions (separating each with a semicolon) for the file
types whose default you want to override.
5 Choose OK twice to confirm your settings, then close the Tools dialog box.
Your new tool has now been added to the Tool list of the associated project, and to the
Tool menu or SpeedMenu, depending on where you chose to add the item. If you added
the item to the Tool menu, you can check the addition by choosing Tool from the main
menu; the new program name appears on the Tool list.
Note Although the Project Manager lets you define your own Tool items, these items apply
only to the project that you add them to; they aren’t added as permanent parts of the
IDE.

Chapter 2, Creating and managing projects 33


34 User’s Guide
Chapter

Specifying project options and


Chapter 3
3
compiling
After you create a project file and write the code for the source nodes in your project,
you need to set the options for the different project nodes before you can compile the
project. This chapter describes how to set options in a project, how to view the options
you set, how to compile a project, and how to use the Message window to view and fix
compile-time errors. In addition, this chapter contains a complete reference to the
compiler and linker options that can be set from the IDE.

Setting project options


Project options tell the IDE how to compile and link the nodes in your project to form the
targets you need. The settings of the project options can indicate whether or not to
generate debugging information, where to look for source code, what types of compiler
optimizations you want to use, and so on.
The Project Manager lets you set project options in two different ways:
• You can attach Style Sheets to your project nodes.
• You can override the settings in a Style Sheet using local overrides.
Style Sheets group a collection of option settings into a single unit. Once a Style Sheet is
created, you can attach it to a node, a group of nodes, or an entire project. Local overrides
are settings that take precedence over Style Sheet settings at the node level.

Using Style Sheets


Often, different project nodes require different option settings. For example, you might
want to compile .C files with one set of options and .CPP files with another, or you
might want to build one target with debugging information, and another one without it.
By applying different Style Sheets to different nodes in your projects, you can easily

Chapter 3, Specifying project options and compiling 35


control how the different nodes get built. In addition, Style Sheets make it easy to view
and maintain the settings of your project options.
To view the options that can be incorporated into a Style Sheet, open the Project Options
dialog box by choosing Options|Project. This dialog box contains a hierarchical list of
topics on the left, with the options that relate to each topic listed on the right. To expand
and collapse the Topic list, click the + and – icons to the left of the topic listings.
Figure 3.1 The Project Options dialog box

To see an example of how Style Sheets are used in a project, open the STYLESHT.IDE
project file located in the EXAMPLES\IDE\STYLESHT directory of your Turbo C++
directory tree. This file uses a different Style Sheet for each of its two versions of
WHELLO. The project also contains a text file that explains the use of Style Sheets.

Predefined Style Sheets


The Project Manager contains several predefined Style Sheets that you can attach to any
node in your project. You can also customize a predefined Style Sheet to meet the special
needs of your projects, as described in “Managing Style Sheets” on page 37.
To inspect the predefined Style Sheets, choose Options|Style Sheets. This opens the
Style Sheets dialog box (shown in Figure 3.2), which lists the predefined Style Sheets on
the left and a description of the selected Style Sheet on the right.

The default project options


When you initially create a project, the project inherits the Style Sheet known as the
Default Project Options (see “Option defaults” on page 58 for information on these
default settings). If you can build all the components in your project with the same
options, you can edit this Style Sheet using the Project Options dialog box. However, if
different nodes in your project require different option settings, you should override the
default option settings by attaching different Style Sheets to the nodes in your project.

36 User’s Guide
Figure 3.2 Style Sheets dialog box

Warning! Be careful when you use the Options|Project command to modify option settings; if
your project contains more than a single target node, the changes you make always
modify the project’s Default Project Options (regardless of the node you have selected
when you choose the command). Because of this, all targets in your project inherit the
changes you make when you use the Options|Project command. In addition, if you
modify project options when you don’t have a project loaded, your modifications
update the Default Project Options Style Sheet; the projects you later create will inherit
these new default settings. If you need to revert to the IDE’s factory default settings,
delete the file TCWDEF.TCW (located in the \TCWIN45\BIN directory), then open and
close the IDE to create a new file.

Managing Style Sheets


The buttons at the bottom of the Style Sheets dialog box let you create, compose, copy,
edit, rename, and delete user-defined Style Sheets.
• Create lets you design a new Style Sheet for the currently loaded project. To create a
Style Sheet,
1 Choose the Create button, then enter a name for your new Style Sheet into the
Create Style Sheet dialog box. Choose OK to add the new Style Sheet to the
Available Style Sheets list.
2 Select the new Style Sheet from the Available Style Sheets list, then use the
Compose, Copy, or Edit buttons to create your custom Style Sheet.
• Compose lets you create a Style Sheet that contains the combined options from one
or more Style Sheets. To compose a Style Sheet,
1 Create a new Style Sheet using the Create button.
2 Select the new Style Sheet in the Available Style Sheets list, then click Compose.
3 Select the Style Sheet you want included in your new Style Sheet from the
Available Style Sheets list, then move the Style Sheet to the Composite Style Sheets
list by double-clicking it or by clicking the → button. (You can also remove Style

Chapter 3, Specifying project options and compiling 37


Sheets from the Composite Style Sheet list by selecting a Style Sheet there and
clicking ←.)
4 Continue modifying the composed Style Sheet, then choose OK when you’re
finished.
Note You cannot edit the option settings in a composed Style Sheet. However, you can edit
the option settings in the Style Sheets contained in the composed Style Sheet, which
affects the settings in the composed Style Sheet.
• Copy lets you create a new Style Sheet from an existing one. When you choose Copy,
you’re prompted for the new Style Sheet’s name. Enter the new name, then choose
OK to make an exact copy of the selected Style Sheet. Copying is a fast way to create a
Style Sheet that closely resembles another—you only have to change the options you
want.
• Edit lets you modify the option settings of an existing Style Sheet, including any
predefined Style Sheet.
• Rename lets you rename a selected Style Sheet.
• Delete lets you remove an unwanted Style Sheet. (This action cannot be reversed.)

Attaching Style Sheets to a node


To attach a Style Sheet to a project node,
1 Right-click the node in the Project Tree (or select it and press Alt+F10).
2 Choose Edit Node Attributes from the SpeedMenu. The Node Attributes dialog box
appears.
3 Select a Style Sheet from the drop-down box, then choose OK.
When you attach a Style Sheet to a node, all the child nodes of that node inherit the
settings of the selected Style Sheet. To change the settings of a child node, attach a
different Style Sheet, or override an option setting using a local override.
Note Although you can attach only a single Style Sheet to a project node, one Style Sheet can
be composed of several different Style Sheets.

Sharing Style Sheets between projects


When you create a custom Style Sheet, that Style Sheet remains with the project for
which it was created; it doesn’t get added to the list of predefined Style Sheets.
However, if you want a new project to use one of your custom Style Sheets or user-
defined tools, you can do so by letting a project inherit the settings of another project.
Before a project can inherit the settings of another project, you must modify the
TCW.INI file that resides in your Windows directory. If the file doesn’t contain an
inherit setting, then you must add the settings to the file as follows:
[Project]
;To have new projects inherit settings from the Default Project Settings (default):
inherit=0

38 User’s Guide
;To have new projects inherit settings from currently open project:
inherit=1

;To have new projects inherit factory default settings:


inherit=2
To pass Style Sheets or user-defined tools from one project to a new project,
1 Modify TCW.INI so that inherit=1.
2 Open the project that contains the Style Sheet or tools you want to share.
3 Choose Project|New Project.
When the new project is created, it inherits the Style Sheets and user-defined tools of the
project that was open when you choose Project|New Project.

Setting local overrides


Option settings can be overridden at the node level using local overrides. Local overrides
are useful when a node’s option settings must differ from its associated Style Sheet by
one or two settings.
Note Although local overrides make it easy to set options for individual nodes, they have the
disadvantage of being difficult to track. While the Options Hierarchy dialog box
(described in “Viewing project options” on page 40) displays the Style Sheet and local
override settings for a selected node, you must examine each individual node to see
which ones have been overridden. Because of this, it’s recommended that you use
separate Style Sheets for nodes that require different option settings, and use local
overrides only in special cases.
To override an option setting,
1 Choose the node whose settings you want to override.
2 Right-click the node (or press Alt+F10) and choose Edit Local Options from the
SpeedMenu. The Options dialog box (which is similar to the Project Options dialog
box) appears and displays the settings for that node.
3 Select the option you want to override. The IDE automatically checks the Local
Override box whenever you modify a Style Sheet setting.
4 Choose OK to confirm your new settings.
Warning! The Local Override check box is enabled only when an option within a topic is selected;
otherwise, the check box is grayed. When you select an option (using Tab, or by clicking
and dragging the mouse off the option), the Local Override check box shows the status
of the selected option. Because of this, you must individually select each option in a topic
to see which ones have been overridden locally. If you choose an option (by clicking it, or
by selecting it and pressing Enter), you change its setting, which always causes the Local
Override check box to be checked.
To undo an override,
1 Right-click the node whose setting you want to modify, then choose Edit Local
Options from the SpeedMenu.

Chapter 3, Specifying project options and compiling 39


2 In the Options dialog box, select the topic that contains the overridden setting.
When you select a topic page that has a locally overridden option, the Project
Manager enables the Undo Page button.
3 Select the option (using Tab, or by clicking and dragging the mouse off the option)
whose local override you want to undo; the Local Override check box will be
checked.
4 Click the Local Override check box to undo the override; the option will revert to its
default Style Sheet setting. To revert the entire topic to the settings contained in the
associated Style Sheet, choose the Undo Page button.
5 Choose OK to confirm your modifications.

Viewing project options


Because each node can have its own Style Sheet and you can override the options in the
Style Sheet, you need a quick way to view the option settings for each node.
To view option settings for the nodes in your project,
1 Right-click any node in the Project window and choose View Options Hierarchy, or
click the button on the SpeedBar.
The Options Hierarchy dialog box appears, listing the nodes in the project on the left
and the options that each node uses on the right. You can expand and collapse the list
of nodes in the dialog box just like you can in the Project window, however,
Autodependency nodes don’t appear.
Note An option that’s surrounded by double-asterisks (**) in the Options listing indicates
that the option is overridden (by either a Style Sheet or local override) by a dependent
node located farther down in the Options listing. (The asterisks display only when
you select the node where the option is overridden.)
Figure 3.3 The Options Hierarchy dialog box

2 When you select a node in the Project Options At list, its settings appear to the right
in the Options list.

40 User’s Guide
The Options list displays components of the project in square brackets. At the top of
the list, you’ll see the name of the project followed by its Default Project Options.
Below this is the name of the target associated with the node you’ve selected. If the
node has a Style Sheet associated with it, it’s displayed beneath the node (also in
brackets), along with the settings of the Style Sheet. If you’ve overridden any settings,
these are displayed beneath the [Node overrides] listing. The Options list displays the
settings for all the ancestors of the node selected in the Project Tree.
3 If you want to edit an option, double-click the option in the Option list, or select it and
click Edit. Whenever you edit options in this manner, the modifications become local
overrides.
4 When you finish viewing your project’s option settings, choose Close.

Compiling projects
There are two basic ways to compile projects: build and make. Build compiles and links
all the nodes in a project, regardless of file dates. Make compares the time stamp of the
target with the time stamps of all the files used to build the target. Make then compiles
and links only those nodes necessary to bring the target up to date.
To compile a project, open the project using the Project|Open command, then choose
one Compile, Make All, or Build All from the Project menu (note that the SpeedBar has
three similar looking buttons that correspond to these Project Menu commands).
• Compile (Alt+F9) builds the code in the currently active Edit window. If a Project
window is selected, all the selected nodes in the project are translated; child nodes
aren’t translated unless they’re selected.
• Make All (F9) translates all the out-of-date nodes in a project. If a project is not open,
the file contained in the active Edit window buffer is built.
When you choose Make All, the Project Manager moves down the Project Tree until
it finds a node with no dependents. The Project Manager then compares that node’s
date and time against the date and time of the node’s parent. The Project Manager
translates the node only if the child node is newer than the parent node. The Project
Manager then moves up the Project Tree and checks the next node’s date and time. In
this way, the Project Manager recurses through the Project Tree, translating only
those nodes that have been updated since the last compile.
• Build All translates all nodes in a project—even if they are up-to-date. Build All
always starts at the project node and builds each successive target down the project.
Choose Cancel to stop a build.
When you choose Build All, the Project Manager starts at the first target and works
down the Project Tree until it comes to a node with no dependents. The Project
Manager compiles that node first (and other nodes on the same level), then works
back up the Project Tree, compiling and linking all the nodes needed to create the
target. This process is then repeated down the Project Tree, until all the targets have
been updated.

Chapter 3, Specifying project options and compiling 41


For example, if you have a project with an .EXE target that is dependent on two
separate .OBJ files, the Project Manager creates the first .OBJ file by compiling all its
dependents. It then creates the next .OBJ file. Once a target node’s dependents are
created, it can compile or link the target node. In this case, the Project Manager will
link the two .OBJ files (and any runtime nodes) to create the final .EXE.

Compiling part of a project


There are several ways to compile specific parts of a project. You can
• Translate an individual node
• Build a node and its dependents
• Make a node and its dependents
• Select several nodes and compile
To translate an individual node,
1 Select the node you want to translate.
2 Choose Project|Compile from the main menu or choose the default translation
command from the SpeedMenu. For example, if you’ve selected a .CPP file, the node
SpeedMenu contains the command C++ Compile, which compiles only the selected
node.
To build a node and its dependents,
1 Select the node you want to build.
2 Right-click the node (or press Alt+F10) and choose Build Node from the SpeedMenu.
All the dependent nodes are built regardless of whether they’re out-of-date.
To make a node and its dependents,
1 Select the node you want to build.
2 Right-click the node (or press Alt+F10) and choose Make Node from the SpeedMenu.
This command compiles only the dependent nodes whose source files are newer than
their associated target files.
To compile several selected nodes,
1 Select the project nodes you want to compile by pressing Ctrl and clicking the desired
project nodes. (The nodes must be of the same file type, such as .CPP).
2 Choose Make Node or Build Node from the Project Manager SpeedMenu to compile
the selected nodes.

Fixing compile-time errors


Compile-time errors, or syntax errors, occur when your code violates a syntax rule of the
language you’re programming in; the C++ compiler cannot compile your program
unless it contains valid language statements. If the compiler encounters a syntax error
while compiling your code, the Message window opens and displays the type of error

42 User’s Guide
or warning it encountered. By choosing Options|Environment|Preferences, you can
specify if old messages should be preserved or deleted between calls to different
programming tools (such as a compiler, GREP, or the resource compiler). Check Save
Old Messages if you want the Message window to retain its current listing of messages
when you run a tool.
To clear the Message window, choose Remove All Messages from the Message window
SpeedMenu.

Viewing errors
To view the code that caused a compiler error or warning, select the message in the
Message window; the IDE updates the Edit window so that it displays the location in
your code where the error or warning occurred (this is called Automatic Error
Tracking). If the file containing the error isn’t loaded in an Edit window, press Spacebar
to load the file (you can also load the file by pressing Alt+F10, then choosing View Source
from the SpeedMenu). When you view errors in this manner, the Message window
remains selected so you can navigate from message to message. To open or view the
Message window, click the button on the SpeedMenu, or choose View|Message.

Fixing errors
To edit the code associated with an error or warning, either
• Double-click the message in the Message window
• Select the message in the Message window and press Enter
• Press Alt+F10 and choose Edit Source from the SpeedMenu
The Edit window gains focus with the insertion point placed on the line and column in
your source code where the compiler detected the error. From here, edit your code to fix
the error. After fixing the error, press Alt+F7 to move to the next error message in the list
or press Alt+F8 to go back to the previous message.

Project options reference


You set compiler, linker, librarian, and make options in the Project Options multiple-
page dialog box. In the following sections, the options in the Project Options dialog box
are described in the order that they appear in the Topics list on the left side of the box.
The chapter ends with a section listing the default options set by the IDE.

Directories
Include searches the path (the drive specifier or path name of a subdirectory) for include
files. A drive specifier is a single letter, either uppercase or lowercase, followed by a
colon (:). A directory is any valid directory or directory path. You can specify multiple
drives and paths by separating the different entries with a semicolon (;). See “File-search
algorithms” for more information on searching.

Chapter 3, Specifying project options and compiling 43


Library instructs the IDE to get the C0x.OBJ startup file, the Turbo C++ library files, and
all other .OBJ and .LIB files from the named directory or directories. By default, the
linker looks for the files in the directory containing the project files.
Source is an additional set of directories where the IDE looks for source code.
Intermediate is where the associated tool (such as a compiler or resource compiler)
places any files that the tool creates.
Final is the location where the IDE places the generated target files (for example, .EXE
and .DLL files).

File-search algorithms
Turbo C++ searches for files included in your source code with the #include directive in
the following ways:
• If you put an #include <somefile.h> statement in your source code, Turbo C++
searches for somefile.h only in the directories specified in the include path.
• If you put an #include "somefile.h" statement in your code, Turbo C++ first searches
for somefile.h in the current directory; if it doesn’t find the file there, it then searches
the directories specified in the include path.
However, if you specify a path and/or a directory, Turbo C++ searches only the
location specified. For example, the path C:\TCWIN45\INCLUDE indicates that the
included file #include <owl\owl.h> resides in the directory
\TCWIN45\INCLUDE\OWL, and not in \TCWIN45\INCLUDE or C:\OWL.
Library file search algorithms are similar to those for include files:
• Turbo C++ searches for implicit libraries in only the specified library directories; this
search algorithm is similar to the one used for #include <file.h> statements. Implicit
library files are the libraries that are automatically linked and the startup object file
C0x.OBJ. To see these files in the Project Manager, turn on run-time nodes (choose
Options|Environment|Project View then check Show Runtime Nodes).
• How Turbo C++ searches for explicit libraries depends in part on how you list the
library file (explicit library files are the .LIB files you list in your project file):
• If you list an explicit library without listing a drive or directory (like this:
mylib.lib), Turbo C++ first searches for the file in the directory containing the
project file. If it’s not found there, the search continues in the specified library
directories. This is similar to the search algorithm for #include “somefile.h”.
• If you list a drive and/or directory name with an explicit library (such as
c:\my_libs\mylib1.lib), Turbo C++ searches only the location specified with the
library file name; other directories are not searched.

Compiler
The compiler topic contains general compiler options, such as the debugging options,
the code generation options, and so on.

44 User’s Guide
Defines
The macro definition capability of Turbo C++ lets you define and undefine macros (also
called manifest or symbolic constants). The macros you define override those defined in
your source files. To define macros, type their definitions in the Defines input box under
the Defines page of the Compiler topic. To enter multiple define statements, separate
each entry with a semicolon (;). For example,
Switch1;Switch2;Switch3=OFF

Code generation
Allocate enums As ints allocates a two-byte int (16-bit) or four-byte int (32 bit) for
enumeration types. This option is on by default. Unchecked, this option allocates the
smallest variable size that can hold the enumeration values: the compiler allocates an
unsigned or signed char if the values of the enumeration are within the range of 0 to 255
(minimum) or –128 to 127 (maximum), or an unsigned or signed short if the values of
the enumeration are within 0 to 65,535 (minimum) or –32,768 to 32,767 (maximum).
The compiler allocates a two-byte int (16-bit) or a four-byte int (32-bit) to represent the
enumeration values if any value is out of range.
Unsigned Characters treats all char declarations as if they were unsigned char, which
provides compatibility with other compilers. Turbo C++ defaults char declarations to
signed.
Duplicate Strings Merged merges literal strings when one string matches another,
producing smaller programs but slightly longer compilation times. This option can
cause errors if one string is modified. This option is unchecked by default.
fastthis uses the _ _fastthis calling convention for passing the this pointer in a register
to member functions.
With fastthis enabled, the compiler expects member functions to pass their this pointer
in a register (or a register pair in large data models). Likewise, calls to member functions
will load the register (or register pair) with the this pointer.
You can enable fastthis using the fastthis option on the Compiler|Code Generation
topic. You can also use the language-specifier keyword _ _fastthis.
In the small data models, the this pointer is supplied in the SI register; large data models
use DS:SI. If necessary, the compiler saves and restores DS. All references in the member
function to member data are done via the SI register.
The names of member functions compiled with fastthis are mangled differently from
non-fastthis member functions, to prevent mixing the two. It’s easiest to compile all
classes with fastthis, but you can compile some classes with fastthis and some without.
None turns off the use of register variables.
Register Keyword specifies that Turbo C++ uses register variables only if you use the
register keyword and a register is available. You can use –rd in #pragma options. Use
this option to optimize the use of registers.

Chapter 3, Specifying project options and compiling 45


Automatic uses register variables. The compiler automatically assigns variables to
registers if possible, even when you don’t specify a register variable by using the
register type specifier. This option is on by default.

Floating Point
No Floating Point, when checked, specifies that the program contains no floating-point
calculations, so no floating-point libraries are linked. Unchecked, this option emulates
80x87 calls at run time.
Fast Floating Point optimizes floating-point operations without regard to explicit or
implicit type conversions. This option can provide answers faster than under the ANSI
operating mode. When this options is unchecked, it turns off the fast floating-point
option. When unchecked, the compiler follows strict ANSI rules regarding floating-
point conversions.

Compiler Output
Autodependency Information generates autodependency information. Modules
compiled with this option on can use MAKE’s autodependency feature. By default,
autodependency is turned on.
Generate Underscores automatically puts an underscore in front of identifiers before
saving them in the object module. Underscores for C and C++ identifiers are optional,
but are on by default. You can set them off; however, setting underscores off might
cause link errors when linking with the standard libraries.
Generate COMDEFs (C only) generates communal variables (COMDEFs) for global C
variables that are not initialized and not declared as static or extern. Use this option
when header files included in several source files contain declarations of global
variables. As long as a given variable doesn’t need to be initialized to a nonzero value,
you don’t need to include a definition for it in any of the source files. This option is
useful when you’re porting code that uses a similar feature with another
implementation.

Source
Nested Comments lets you nest comments in your source code. The default is off.
Identifier Length causes the compiler to recognize only the first n characters of
identifier names. All identifiers, whether variables, preprocessor macros, or structure
members, are treated as distinct when their first n characters are unique. Specifying n to
be 0 or greater than 249, or not specifying the option at all, sets the identifier length to
the default value.
By default, Turbo C++ uses 32 characters per identifier. Other systems, including some
UNIX compilers, ignore characters beyond the first eight. If you are porting to other
environments, you might want to compile your code with a smaller number of
significant characters; this helps you locate name conflicts in long identifiers that have
been truncated.
Borland Extensions uses Turbo C++ keywords. See the Programmer’s Guide for a
complete list of the Turbo C++ keywords.

46 User’s Guide
ANSI compiles ANSI-compatible code. Any non-ANSI keyword is ignored and can be
used as a normal identifier.
UNIX V uses only UNIX language-extension compliance.
Kernighan and Ritchie uses only Kernighan and Ritchie language compliance.

Debugging
These debugging options include debugging information in your generated .OBJ files.
In general, these options increase the size and compilation time of the files, but they
don’t affect the speed of the executable program. However, to link larger .OBJ files, turn
these options off. For information on debugging your applications, see Chapter 7; for
information on browsing, see Chapter 6.
Standard Stack Frame (on by default) generates a standard stack frame, which is useful
when using a debugger to trace through the stack of called subroutines. When turned
off, any function that doesn’t use local variables and has no parameters is compiled with
abbreviated entry and return code, which makes your code smaller and faster.
Test Stack Overflow generates stack overflow logic at the entry of each function. It
causes a stack overflow message to appear when a stack overflow is detected at run
time. This is costly in terms of both program size and speed but is provided as an option
because stack overflows can be very difficult to detect. If an overflow is detected, the
message Stack overflow! is printed and the program exits with an exit code of 1.
Out-of-line Inline Functions expands C++ inline functions inline. To control the
expansion of inline functions, this option acts slightly differently for C++ code: when
inline function expansion isn’t enabled, the function is generated and called like any
other function. Because debugging with inline expansion can be difficult, the command-
line compilers provide the following options:
• –v turns debugging on and inline expansion off.
• –v– turns debugging off and inline expansion on.
• –vi turns inline expansion off (no inline substitution will occur).
• –vi– turns inline expansion on.
For example, if you want to turn both debugging and inline expansion on, you must use
–v –vi–.
Line Numbers includes line number information in your .OBJ files for the integrated
debugger. Line numbers are a subset of debugging information. Although the Debug
Info In OBJs option automatically generates line number information, you can turn off
this option and turn on Line Numbers to reduce the size of the debug information
generated. With this setup, you can still step and trace, but you will not be able to watch
or inspect data items.
Debug Information In OBJs includes debugging information in .OBJ files so that you
can debug your programs with the integrated debugger. The compiler passes this
option to the linker so it can include the debugging information in the .EXE file. For
debugging, this option treats C++ inline functions as normal functions.
Browser Reference Information In OBJs generates additional Browse- specific
information such as definition location information and reference information.

Chapter 3, Specifying project options and compiling 47


Precompiled headers
Generate And Use generates and uses precompiled header files using the default file
name <projectname>.CSM. Precompiled headers can dramatically increase compile
speed, although they require considerable disk space. See Appendix B for more
information on precompiled headers.
Use But Do Not Generate uses preexisting precompiled header files, but doesn’t
generate new ones.
Do Not Generate Or Use doesn’t generate or use precompiled header files.
Precompiled Header Name lets you specify the name of your precompiled header file.
When this option is used from the command line, the compiler generates and uses
precompiled headers and sets the name of the precompiled header file to fname.
Stop Precompiling After Header File stops compiling precompiled headers when it
compiles the file specified as “xxx”.

Advanced Compiler
The following sections describe advanced compiler options.

Processor
80386 generates 16-bit 80386 protected-mode compatible instructions.
i486 generates 16-bit 80486 protected-mode compatible instructions.
Data Alignment Byte/Word align to n: 1 = Byte, 2 = Word (2-bytes). Word forces
integer-size and larger items to be aligned on a machine-word boundary. Extra bytes are
inserted in a structure to ensure member alignment. Automatic and global variables are
aligned properly. char and unsigned char variables and fields can be placed at any
address; all others are placed at an even-numbered address. Byte allows byte-wise
alignment. Word alignment increases the speed with which 80x86 processors fetch and
store data.

Calling Convention
C generates all subroutine and function calls using the C calling convention, which is
equivalent to declaring all subroutines and functions with the _ _cdecl keyword. The C
calling convention allows a function to accept a variable number of arguments from its
call. To specify that a function or subroutine should use another calling convention,
declare the function using either a _ _stdcall, _ _pascal, or _ _fastcall keyword.
Pascal generates all subroutine and function calls using the Pascal calling convention,
which is equivalent to declaring all subroutines and functions with the _ _pascal
keyword. The Pascal calling convention pushes arguments for left to right. The resulting
function calls are usually smaller and faster than they would be if compiled with the C
calling convention. The Pascal calling convention requires that functions pass the correct
number and type of arguments. Use the _ _cdecl, _ _stdcall, or _ _fastcall keywords to
specifically declare a different calling convention for a function or subroutine.

48 User’s Guide
Register generates all subroutine and function calls using the Register calling
convention, which is equivalent to declaring all subroutines and functions with the
_ _fastcall keyword. You can use the _ _stdcall, _ _pascal, or _ _cdecl keywords to
specifically declare a different calling convention for a function or subroutine.

Memory Model
Memory model options let you specify what memory model the compiler should use
when compiling applications. See the Programmer’s Guide, the DOS Reference, and Library
Reference for information on models.
Small compiles using the small memory model (the default).
Medium compiles using the medium memory model.
Compact compiles using the compact memory model.
Large compiles using the large memory model.
Default uses the model to determine if the stack segment is equal to the data segment.
Never assumes that the data segment is never equal to the stack segment, regardless of
the memory model.
The net effect of the Never option is actually very small. If you take the address of a
stack variable (parameter or auto), the default (when DS == SS) is to make the resulting
pointer a near (DS relative) pointer. This way, you can assign the address to a default-
sized pointer in those models without problems. When DS != SS, the pointer type
created when you take the address of a stack variable is an _ss pointer. This means that
the pointer can be freely assigned or passed to a far pointer or to a _ss pointer. But for
the memory models affected, assigning the address to a near or default-sized pointer
produces a “Suspicious pointer conversion” warning. Such warnings are usually errors,
and the warning defaults to on.
Always assumes that DS is equal to SS in all memory models; you can use it when
porting code originally written for an implementation that makes the stack part of the
data segment.
Put Constant Strings In Code Segments moves all string literals from the data segment
to the code segment of the generated object file, making the data type const. Using this
option saves data segment space. In large programs, especially those with a large
number of literal strings, this option shifts the burden from the data segment to the code
segment. This options works only with compact and large memory-model programs.
Far Virtual Tables causes virtual tables to be created in the code segment instead of the
data segment (unless changed using the Far Virtual Tables Segment and Far Virtual
Tables Class options), and makes virtual table pointers into full 32-bit pointers (the latter
is done automatically if you are using the huge memory model).
There are two primary reasons for using this option: to remove the virtual tables from
the data segment, which might be getting full, and to be able to share objects (of classes
with virtual functions) between modules that use different data segments (for example,
a DLL and an executable using that DLL). For all modules that can share objects, you
must compile either entirely with or entirely without this option. You can get the same
effect by using the huge or _export modifiers on a class-by-class basis.

Chapter 3, Specifying project options and compiling 49


Fast Huge Pointers offers an alternative method of calculating huge pointer
expressions. Huge pointers are normalized by the value of the variable _ALTINCR,
which is initialized by Windows at the startup time of the application.
Usually, Turbo C++ normalizes a huge pointer whenever adding to or subtracting from
it. This ensures, for example, that if you have a huge array of structs that’s larger than
64K, indexing into the array and selecting a struct field always works with structs of any
size. Turbo C++ accomplishes this by always normalizing the results of huge pointer
operations—the address offset contains a number that is no higher than 15 and a
segment wraparound never occurs with huge pointers. The disadvantage of this
approach is that it tends to be quite expensive in terms of execution speed.
Automatic Far Data changes global variables greater than or equal to the threshold size
to far. The threshold size defaults to 32,767. This option is useful for code that doesn’t
use the huge memory model but declares enough large global variables that their total
size is close to or exceeds 64K. For tiny, small, and medium models, this option has no
effect. If you use this option in conjunction with the Generate COMDEFs option on the
Compiler|Floating Point page, the generated COMDEFs become far in the compact,
large, and huge models.
Far Data Threshold changes the point where data is forced to be far (used by the Far
Data Threshold option).

Segment Names Data


Use these options only if you have a good understanding of segmentation on the 80x86
processor. Under normal circumstances, you don’t need to specify segment names.
Initialized Data Segment sets the name of the initialized data segment to name. By
default, the initialized data segment is named _DATA for near data and
modulename_DATA for far data.
Initialized Data Group changes the name of the initialized data segment group to name.
By default, the data group is named DGROUP.
Initialized Data Class sets the name of the initialized data segment class to name. By
default, the initialized data segment class is named DATA.
Uninitialized Data Segment changes the name of the uninitialized data segment to
name. By default, the uninitialized data segment is named _BSS for near uninitialized
data and modulename_BSS for far uninitialized data.
Uninitialized Data Group changes the name of the uninitialized data segment group to
name. By default, the data group is named DGROUP.
Uninitialized Data Class changes the name of the uninitialized data segment class to
name. By default, the uninitialized data segments are assigned to class BSS.

Segment Names Far Data


Far Data Segment changes the name of the segment where _ _far objects are put to
name. By default, the segment name is the name of the source file followed by _DATA. A
name beginning with an asterisk (*) indicates that the default string should be used.

50 User’s Guide
Far Data Group causes _ _far objects to be put into group name. By default, _ _far objects
aren’t put into a group. A name beginning with an asterisk (*) indicates that the default
string should be used.
Far Data Class changes the name of the class for _ _far objects to name. By default, the
name is FAR_DATA. A name beginning with an asterisk (*) indicates that the default
string should be used.
Far Virtual Tables Segment sets the name of the far virtual table segment to name. By
default, far virtual tables are generated in the code segment.
Far Virtual Tables Class sets the name of the far virtual table class segment to name. By
default, far virtual table classes are generated in the CODE segment.

Segment Names Code


Code Segment changes the name of the code segment to name. By default, the code
segment is named _TEXT for near code and modulename_TEXT for far code.
Code Group causes any output files to be generated with a code group for the code
segment named name.
Code Class changes the name of the code segment class to name. By default, the code
segment is assigned to class CODE.

Entry/Exit Code
Entry/Exit code options specify what type of application the compiler creates.
Windows All Functions Exportable creates a Windows object module with all far
functions exportable. This option creates the most general kind of Windows executable,
although not necessarily the most efficient. The default for this options is off. This option
generates the necessary overhead information for every far function, whether the
function needs it or not. It assumes that all functions are capable of being called by the
Windows kernel or by other modules.
This option creates a Windows .EXE function prolog/epilog for all far functions, then
sets up those functions to be called from another module. To actually export the
function address from the .EXE to a .DLL, the code includes a call to MakeProcInstance,
passing the resulting pointer to the .DLL requesting the address of the function. To
actually export the function address from the .DLL, function names need to be included
in the .DEF file of the executable.
Windows Explicit Functions Exported creates a Windows object module in which only
far functions declared as _export functions are exportable. Use this option if you have
functions that aren’t called by the Windows kernel. Windows Explicit Functions
Exported operates the same as Windows All Functions Exportable except that only
those functions marked with the _export keyword (and methods of classes marked as
_export) are given the extra prolog/epilog.
This option is far more efficient than Windows All Functions Exportable, because only
those functions called from outside the module get the overhead of the prolog. This
option does, however, require determining in advance which functions/classes need to
be exported. MakeProcInstance is still used, but no .DEF file manipulation is needed; if

Chapter 3, Specifying project options and compiling 51


you use this option along with the _export keyword, you don’t need to define exports in
your .DEF files.
Windows Smart Callbacks, All Functions Exportable creates an object module with
smart callbacks for all far functions exported. Use this option only if the compiler can
assume that DS==SS for all functions in the module (which is the vast majority of
Windows programs, and the default for Borland tools).
This option creates a Windows .EXE function prolog/epilog for all far functions, then
sets up those functions to be called from another module. MakeProcInstance need not be
called and no .DEF file editing is needed.
Windows Smart Callbacks, Explicit Functions Exportable creates an application with
smart callbacks and explicit exported functions. This option is the same as Windows
Smart Callbacks except that only those functions marked with the _export keyword
(and methods of classes marked as _export) are given the extra prolog/epilog. This is far
more efficient because only those functions called from outside the module get the
overhead of the prolog. This option does, however, require determining in advance
which functions/classes need to be exported.
Windows DLL, All Functions Exportable creates a DLL object module with all far
functions exportable. This option creates a Windows DLL function prolog/epilog for all
far functions, then sets up those functions to be called from another module. To actually
export the function address from the .DLL, function names need to be included in the
.DEF file of the executable.
Windows DLL, Explicit Functions Exported creates a DLL object module in which only
far functions marked as _export are exportable. The Windows DLL, Explicit Functions
Exported is the same as Windows DLL, All Functions Exportable, except that only those
functions marked with the _export keyword (and methods of classes marked as
_export) are given the extra prolog/epilog. This is far more efficient than Windows
DLL, All Functions Exportable because only those functions called from outside the
module get the overhead of the prolog. This option does, however, require determining
in advance which functions/classes need to be exported. No .DEF file manipulation is
needed.

C++ Options
The C++ options let you control the compiler’s interpretation of the C++ language.

Member Pointer
Honor Precision Of Member Pointers uses the declared precision for member pointer
types. Use this option when a pointer to a derived class is explicitly cast as a pointer-to-
member of a simpler base class (when the pointer is actually pointing to a derived class
member).
Support All Cases lets member pointers point to any members. Member pointers use
the most general (but not always the most efficient) representation.
Support Multiple Inheritance lets member pointers point to members of multiple
inheritance classes except members of virtual base classes.

52 User’s Guide
Support Single Inheritance lets member pointers point to members of single
inheritance classes only.
Smallest For Class uses the smallest representation that lets member pointers point to
all members of their class. If the class isn’t fully defined at the point where the member
pointer type is declared, the most general representation is chosen by the compiler (a
warning is issued).

C++ Compatibility
Do Not Treat ‘char’ As Distinct Type treats char as signed. Compatible with Turbo C++
3.1 and earlier.
Treat ‘far’ Classes As ‘huge’, causes classes that are declared __far to be treated as if
they were declared __huge. When enabled, it allows the following code to compile:
struct __huge A
{
virtual void f();
};
struct __far B : public A
{};
If this option is disabled, the compiler generates the error “Attempting to derive a far
class from the huge base ‘A.’

Virtual Tables
The Virtual Tables option controls the C++ virtual tables. It has the following settings:
Smart generates common C++ virtual tables and out-of-line inline functions across
modules within your application. As a result, only one instance of a given virtual table
or out-of-line inline function is included in the program. This produces the smallest and
most efficient executables, but produces .OBJ and .ASM files compatible with Turbo
C++ and TASM.
Local generates local virtual tables and out-of-line inline functions. As a result, each
module gets its own private copy of each virtual table and out-of-line inline function it
uses. This setting produces larger executable files than the Smart setting.
External creates external references to virtual tables. If you don’t want to use the Smart
or Local options, use the External and Public options to produce and reference global
virtual tables (see the Public option description that follows).
Public produces public definitions for virtual tables. When using the External or Public
options, at least one of the modules in the program must be compiled with the Public
option to supply the definitions for the virtual tables. All other modules should be
compiled with the External option to refer to that Public copy of the virtual tables.

Templates
For more information about templates, see the Programmer’s Guide.
Smart generates public definitions of all template instances. If more than one module
generates the same template instance, the linker merges them to produce a single copy

Chapter 3, Specifying project options and compiling 53


of the instance. To generate the instances, however, the compiler must have available
the function body (in the case of a template function) or the bodies of the member
functions and definitions for static data members (in the case of a template class).
Global generates public definitions for all template instances encountered. Duplicate
instances are not merged, causing the linker to report public symbol redefinition errors if
more than one module defines the same template instance.
External generates external references to template instances. Make sure instances are
publicly defined in some other module (using the Global option), so that external
references are properly resolved.

Exception handling/RTTI
Enable Exceptions enables C++ exception handling. If you implement C++ exception
handling in your code and compile with this option disabled, you’ll get an error.
Note that turning off this option turns off only the compilation of exception handling
code. Your application can still include exception code if it includes .OBJ and library
files that were built with exceptions enabled (such as the Borland standard libraries).
Enable Exception Location Information makes available run-time identification of
exceptions by providing the line numbers in the source code where the exception
occurred. This lets the program query the file and line number from where a C++
exception occurred.
Enable Destructor Cleanup calls destructors for all automatically declared objects
between the scope of the catch and throw statements when an exception is thrown. Note
that destructors aren’t automatically called for dynamic objects and dynamic objects
aren’t automatically freed.
Enable Fast Exception Prologs expands inline code for every exception handling
function. This option improves performance, but it increases the .EXE file size. Note that
if you select both this option and Enable Compatible Exceptions, fast prologs will not be
generated.
Enable Compatible Exceptions allows .EXEs and .DLLs built with Turbo C++ to be
compatible with .EXEs built with other products. When this option is enabled, some
exception handling information is included in the executible files (even if Enable
Exceptions is turned off), which could cause compatibility issues.
Enable Runtime Type Information generates code that allows run-time type
identification. In general, when Destructor Cleanup is enabled, Enable Runtime Type
Information must be enabled as well.

Messages
You can control the error and warning messages that are generated by the compiler
with the options listed under the Messages topic. Setting a message option causes the
compiler to generate the associated message or warning when the specific condition
arises. For information on the individual error messages, refer to the online Help from
the specific Message topic in the Project Options dialog box, and to Appendix C.

54 User’s Guide
All displays all warning messages.
Selected enables the aaa warning message typed at the command line or checked in the
IDE. Using the pragma warn in your source code overrides message options set either at
the command line or in the IDE. See the Programmer’s Guide for more information on
pragmas.
None represses the display warning messages. Errors are still displayed.
Stop After n Warnings stops compiling after n warnings occur in your project.
Stop After n Errors stops compiling after n errors occur in your project.

Linker
The IDE automatically links the files necessary to create the executable targets in your
project. The next few sections describe the linker options that are available from the
Project Options dialog box.

General
Case Sensitive Link makes the case significant in public and external symbols.
Case Sensitive Exports And Imports makes the case significant in the EXPORTS and
IMPORTS sections in module-definition files.
Include Debug Information selectively enables or disables debugging information on a
module-by-module basis.
Default Libraries ignores default libraries specified by some compilers. Use this option
when linking modules that are written in another language.
Pack Code Segments combines as many code segments as possible in one physical
segment up to (and never greater than) the code-segment packing limit. The linker starts
a new segment if it needs to. The default code-segment packing limit is 8,192 bytes (8K).
Code Pack Size. Use this setting to change the code-segment size, where n specifies the
number of bytes between 1 and 65,536. You would probably want the limit to be a
multiple of 4K under 386 enhanced mode because of the paging granularity of the
system.
Although the optimum segment size in 386 enhanced mode is 4K, the default code-
segment packing size is 8K because typical code segments are from 4K to 8K, and 8K
might pack more efficiently.
Because each maintained segment has some system overhead, code-segment packing
typically increases performance. Turn off code-segment packing if you’ve turned it on in
the configuration file and want to disable it for a particular link.
Warn Duplicate Symbol In .LIB warns you if a symbol appears in more than one object
or library file. If the symbol must be included in the program, the linker uses the symbol
definition from the first file containing the symbol that it encounters during the link.

Chapter 3, Specifying project options and compiling 55


Map File
Off tells the linker to not generate a map file.
Segments creates a map file with the same features as the publics option, but adds a
detailed segment map. If you don’t specify map file options, then the Segments option is
used. For each segment in each module, this map file includes the address, length in
bytes, class, segment name, group, module, and ACBP information. If the same segment
appears in more than one module, each module appears as a separate line. Except for
the ACBP field, the information in the detailed segment map is self-explanatory.
The ACBP field encodes the A (alignment), C (combination), and B (big) attributes into a
set of four bit fields, as defined by Intel. The linker uses only three of the fields, the A, C,
and B fields. The ACBP value in the map is printed in hexadecimal. The following
values of the fields must be OR’ed together to arrive at the ACBP value printed.

Field Value Description


The A field (alignment) 00 An absolute segment.
20 A byte-aligned segment.
40 A word-aligned segment.
60 A paragraph-aligned segment.
80 A page-aligned segment.
A0 An unnamed absolute portion of storage.
The C field (combination) 00 Cannot be combined.
08 A public combining segment.
The B field (big) 00 Segment less than 64K.
02 Segment exactly 64K.

With the Segments option, public symbols with no references are flagged “idle.” An idle
symbol is a publicly-defined symbol in a module that wasn’t referenced by an EXTDEF
record by any other module included in the link. For example, this fragment from the
public symbol section of a map file indicates that symbols Symbol1 and Symbol3 aren’t
referenced by the image being linked:

0002:00000874 Idle Symbol1


0002:00000CE4 Symbol2
0002:000000E7 Idle Symbol3

Publics tells the linker to create the same map file that the Segments option produces,
but the linker adds a list of public symbols at the end of the file; which is sorted
alphabetically as well as in increasing address order. This type of map file is helpful
when debugging.
Detailed creates a more complete map than the linker normally does by adding a list of
sorted public symbols to the map file. This kind of map file is useful in debugging.
Many debuggers can use the list of public symbols, which lets you refer to symbolic
addresses when you’re debugging.
Print Mangled Names In Map File puts mangled names in the map file; this can help
you identify how names are mangled. This option is provided because some utilities
require mangled names as input.

56 User’s Guide
Include Source Line Numbers creates a section in the .MAP file for source-code line
numbers. Linked .OBJ files must be compiled with debug information using the Line
Numbers of Include Debug Information options. If you use set the Map File option to
Off, this option has no effect.

Advanced Linker
Initialize Segments outputs uninitialized trailing segments into the executable file even
if the segments don’t contain data records. This option is normally not needed, and will
increase the size of your .EXE files.
Inhibit Optimizing Far Call To Near inhibits the optimization of far calls to near data.
When the linker packs two code segments together, and far calls are made from one to
the other, the linker optimizes the code by converting the far calls to near calls. This
option inhibits this optimization. This option is useful if you experience run-time
crashes that appear to be related to the corruption of the virtual tables. Because virtual
tables reside in the code segment, their contents can sometimes be interpreted by the
linker as one of these far calls.
Enable 32-bit Processing lets you link 32-bit modules produced by TASM or a
compatible assembler. This option requires more memory and slows down linking.
Segment Alignment specifies alignment for code and data within the executable file.
Use this option to change the current byte value on which to align segments. Valid
number values are the range of 2 to 65,535. The value entered is rounded up to the
nearest power of two (note that this is different than the File Alignment option). For
example, if you enter 650, it is rounded up to 1,024. The operating system seeks pages
for loading based on this alignment value. The default value is 512.
Discard Nonresident Name Table causes the linker to not emit the nonresident names
table. The resultant image will contain only the module description in the nonresident
names table (see the following note for usage).
Transfer Resident Names To Nonresident Names Table causes the linker to copy all
names in the resident names table which have not been specified as RESIDENTNAME
in the .DEF file to the nonresident names table. The resultant image contains only the
module name and the symbol names those exported symbols that were specified as
RESIDENTNAME in the .DEF file.
When specifying this switch, you must also specify the WEP entry point as a
RESIDENTNAME in the EXPORTS section of the .DEF file—Windows obtains the WEP
entry point for this symbol by looking it up in the resident names table.
Note When building .DLLs that contain many exports, it’s possible to exceed the 64K header
file limitation. Because the .DLL contains the resident names table its the header,
moving the exports out of the header using the Transfer Resident Names to Nonresident
Names Table option usually remedies this problem. Names in the nonresident names
table are assigned ordinal numbers, which your .EXE file uses when referencing the
entry points in the .DLL. There are two ways to create input files for the linker:
• Run IMPLIB on the .DLL to create an import library for linking purposes.
• Run IMPDEF on the .DLL to create a .DEF file for linking purposes.

Chapter 3, Specifying project options and compiling 57


Once the import library or .DEF file has been created, there is no need to keep the names
in either the resident or the nonresident names tables. Relinking the .DLL and specifying
both the Transfer Resident Names To Nonresident Names Table and Discard
Nonresident Names Table options cause the linker to build a .DLL with an “empty”
names table. Not only does this post-processing avoid the problem of exceeding the
header limitation, it also creates a .DLL that loads faster (because it’s smaller) and runs
faster (because references to entry points are by ordinal number instead of by name). To
summarize this process, you must:
1 Enable the Transfer Resident Names To Nonresident Names Table option to transfer
the names in the resident names table to the nonresident names table. This also
assigns ordinal numbers to the names. However, before doing so; make sure you
have included a .DEF file with the following export definition in the EXPORTS
section:
EXPORTS
WEP @1 RESIDENTNAME
2 Build the .DLL.
3 Run IMPLIB/IMPDEF on the new .DLL file.
4 Enable the Discard Nonresident Names Table option.
5 Relink the .DLL.

Other Project Options dialog box options


Definitions for the Librarian, Resources, and Make topics in the Project Options dialog
box can be found in online Help by selecting the options, then choosing the Help button.

Option defaults
When you create a new project, the Project Manager assigns the project the Default Style
Options Style Sheet. The following table shows the default IDE options:
Table 3.1 Default Project Option settings
Option
Compiler | Defines
Compiler | Code Generation | Allocate enums As ints
Compiler | Code Generation | Register Variables: Automatic
Compiler | Floating Point | Fast Floating Point
Compiler | Compiler Output | Autodependency Information
Compiler | Compiler Output | Generate Underscores
Compiler | Source | Borland Extensions
Compiler | Debugging | Standard Stack Frame
Compiler | Debugging |Debug Information In OBJs
Compiler | Debugging |Browser Reference Information In OBJs
Compiler | Precompiled Headers | Generate And Use

58 User’s Guide
Table 3.1 Default Project Option settings (continued)
Option
Advanced Compiler | Processor | Instruction Set: 80386
Advanced Compiler | Processor | Data Alignment: Byte
Advanced Compiler | Calling Convention | C
Advanced Compiler | Memory Model | Large
Advanced Compiler | Entry/Exit Code | Windows smart callbacks, All Functions Exportable
C++ Options | Member Pointer | Member Pointer Representation: Support All Cases
C++ Options | C++ Compatibility | Virtual Base Pointers: Always Near
C++ Options | Virtual Tables | Linkage: Smart
C++ Options | Templates | Instance Generation: Smart
C++ Options | Exception Handling/RTTI | Enable Exceptions
C++ Options | Exception Handling/RTTI | Enable Destructor Cleanup
C++ Options | Exception Handling/RTTI | Enable Runtime Type Information
Messages (see “Messages” on page 54 for default Message information)
Linker | General | Case Sensitive Link
Linker | General | Case Sensitive Exports And Imports
Linker | General | Include Debug Information
Linker | General | Default Libraries
Linker | General | Pack Code Segments (Code Pack Size 8192)
Linker | Map File | Off
Linker | Map File | Include Source Line Numbers
Make | Break Make On: Errors
Make | Autodependencies: Cache

Chapter 3, Specifying project options and compiling 59


60 User’s Guide
Chapter

Building applications with AppExpert


Chapter 4
4
AppExpert generates ObjectWindows 2.0 applications, which provide source-code
foundations to the Windows applications you want to create. For example, AppExpert
generates the source code for your main and child windows, tool bars, status bars, menu
systems, and online Help systems. You can also use AppExpert to add other features to
your Windows programs, such as scroll bars, Min and Max boxes on a caption bar, and
printing and print preview.
After AppExpert generates an application, you can use ClassExpert and Resource
Workshop to help complete the program functionality. To get the most out of
AppExpert, you should be familiar with ClassExpert (described in Chapter 5), Resource
Workshop (described in Part II), ObjectWindows (described in ObjectWindows
Programmer’s Guide), and the Project Manager (described in Chapter 2).
AppExpert lets you create programs that conform to the following program models:
• Single-document interface (SDI) model, which lets you have only a single object open
at a time.
• Multiple-document interface (MDI) model, which lets you have a number of objects
and views open at the same time.
• “Dialog Client” model, which uses a dialog box as the main user interface.
In addition, you can choose to have your application follow the Document/View model
of ObjectWindows (for more information on Document/View, see the ObjectWindows
Programmer’s Guide).
This chapter provides the following sections to help you get started with AppExpert:
• “AppExpert basics” describes the general method for creating an application with
AppExpert.
• “Creating a small application” shows you how to create an SDI application.
• “AppExpert options reference” summarizes AppExpert options.

Chapter 4, Building applications with AppExpert 61


AppExpert basics
The following steps outline the basic tasks involved in creating an application:
1 Use AppExpert to define the user interface and general features of your application.
2 Generate the source code of your application.
3 Use ClassExpert to add functionality to your application. With ClassExpert, you add
code to classes, event handlers, virtual functions, and so on.
4 Use Resource Workshop to edit and add Windows resources, such as dialogs, dialog
controls, and menus.
5 Use the Project Manager to build your program.
When you generate an application with AppExpert, it creates the following files:

• A project file (.IDE) • A header file (.h)


• A source file (.CPP) • A resource script file (.RC)
• A resource header file (.RH) • An AppExpert database file (.APX)
• A module-definition file (.DEF)
Depending on the options you choose, AppExpert can also generate the following files:

• Help source files (.RTF)


• A Help project file (.HPJ)
• Icon and bitmap files (.ICO and .BMP)

Creating a small application


The following tutorial shows how to use AppExpert to create an SDI application that
uses the ObjectWindows framework.
1 Start the IDE and choose Project|AppExpert to open the New AppExpert Project
dialog box.
2 Type \myapp\draw into the File Name text box. This specifies both the path and the
project file name for your new application. By default, most generated files (including
the .EXE) are derived from the project name you supply.
If the directory you specify doesn’t exist, AppExpert creates it for you. You can also
use the Directories list box to select an existing directory for your project. In either
case, the directory you specify becomes the base directory for all generated source
files. To help organize your project files, it’s best to use a unique base directory for
each project you create.
3 Choose OK. The AppExpert Application Generation Options dialog box appears. It
contains a list of topics on the left, with the options that relate to each topic on the
right. To expand the hierarchical topics list, click the + and – icons to the left of the
listed topics, or right-click in the Topics pane to reveal a SpeedMenu that contains

62 User’s Guide
commands to expand and contract the list of topics. For online help on any of the
options or topics, choose Help.
Figure 4.1 AppExpert Application Generation Options dialog box

4 Select the Application topic, then make the following settings in the Summary
options:
• Set the Window Model to SDI (Single Document Interface).
• Uncheck Document/View.
• Uncheck all Features To Include (Toolbar, Status Line, Drag/Drop, and Printing).
These options settings specify a very simple application. For more information on the
available application settings, see “AppExpert options reference” on page 68.
5 Select the Application|Basic Options topic, then capitalize the Target Name so it
reads “Draw.”
6 Select the Application|Admin Options topic, then change the Description setting to
read “Sample ObjectWindows Program.”
7 Complete the Author and Company text fields.
8 Select the Main Window topic, and set the Window Title to “Sample ObjectWindows
Program.”
9 Select the Main Window|SDI Client topic, then set the Client/View Class to TWindow
(choose this selection from the drop-down list).
10 Choose Generate to have AppExpert create the application.
A dialog box appears asking you to confirm your command. Choose Yes to have
AppExpert generate the files for your application. (Choose No if you need to modify
you option settings.)
A message box displays as AppExpert generates the source modules, header files,
resource files and the project file for your application. AppExpert places the files in
the directory that you specified in the Base Directory setting of Application|Basic
Options.

Chapter 4, Building applications with AppExpert 63


11 After AppExpert generates the application, the Project window appears and lists
most of the files that AppExpert generated. From here, you can build the application,
or you can use ClassExpert to add the functionality of the application. To build your
application, choose Project|Build All.
Note With AppExpert, you specify your application options once, then generate the code.
After generating the code, you can modify the files with ClassExpert, but you can’t go
back to AppExpert and change options. For example, if you generate an application
with no status line, you can’t use AppExpert later to add that functionality—you need to
add it manually, or regenerate the application from scratch.

Overview of the generated code


AppExpert generates the following files when you generate the DRAW.IDE project:
Table 4.1 Sample application files
File name Description
DRAWAPP.CPP Source file for the application object and the main window object.
DRAWAPP.H Header file for the application object and the main window object.
DRAWWNDW.CPP Source file for the client window object.
DRAWWNDW.H Header file for the client window object.
DRWABTDL.CPP Source file for the About dialog box object.
DRWABTDL.H Header file for the About dialog box object.
DRAWAPP.RC The resource script file for the project.
DRAWAPP.RH The resource header file for the project.
DRAWAPP.DEF Module definition file for the project.
DRAW.APX Database files that stores project information which ClassExpert uses.
APPLSDI.ICO Predefined icon for the project.
DRAW.IDE The IDE project file.

The application object


After you generate DRAW.IDE, the Project Manager opens and displays the a project
tree showing the project files generated by AppExpert. Figure 4.2 shows DRAW.IDE in
the Project Manager (the Project Manager has both run-time nodes and the project node
visible).

64 User’s Guide
Figure 4.2 DRAW.IDE loaded into the Project Manager

From the Project Manager, open DRAWAPP.CPP by double-clicking the source-file


listing. The rest of this section describes the code in this file.
/* Project Draw
The SourceWorks, Inc.
Copyright © 1994. All Rights Reserved.

SUBSYSTEM: draw.exe Application


FILE: drawapp.cpp
AUTHOR: Ed Moddy
ƒ
The first few lines in the file describe the application. AppExpert gets some of this
information from your entries in the Application|Administrative Options topic. Farther
down in the listing, you’ll notice a number of comments with a structure similar to the
following lines of code:
//{{ ... }}

//{{..._BEGIN}}
ƒ
//{{..._END}}
These two types of comments are ClassExpert comment records which are used by
Rescan. These comments must be left in place if you plan to use ClassExpert to help you
modify your project source code. While you cannot modify lines of code that begin with
\\{{, you can add lines of code between the _BEGIN and _END comment records as long as
you duplicate the format of the generated code that’s in between these comment records.
In the header files listed at the top of DRAWAPP.CPP, you’ll notice a line of code that
includes the file drawapp.h. In this header file, AppExpert defines a class for the main
window, SDIDecFrame. Also in drawapp.h is the class declaration for your application
object:
ƒ
//{{TApplication = DrawApp}}
class DrawApp : public TApplication {
private:
ƒ

Chapter 4, Building applications with AppExpert 65


This code shows that AppExpert derives DrawApp from TApplication. In this DrawApp,
AppExpert defines a constructor and destructor, overrides the function
InitMainWindow, and defines some command response functions.
AppExpert defines the member functions declared in drawapp.h in DRAWAPP.CPP.
AppExpert also defines a response table to handle the basic menu items contained in
DRAWAPP.CPP:
ƒ
//{{DrawApp Implementation}}

//
// Build a response table for all messages/commands handled
// by the application.
//
DEFINE_RESPONSE_TABLE1(DrawApp, TApplication)
//{{DrawAppRSP_TBL_BEGIN}}
EV_COMMAND(CM_FILENEW, CmFileNew),
EV_COMMAND(CM_FILEOPEN, CmFileOpen),
EV_COMMAND(CM_FILECLOSE, CmFileClose),
EV_COMMAND(CM_HELPABOUT, CmHelpAbout),
//{{DrawAppRSP_TBL_END}}
END_RESPONSE_TABLE;
ƒ
Next is the definition of the DrawApp constructor. This constructor initializes a data
structure that’s used in all file-based dialog boxes (for example, dialog boxes that open
or save files).
ƒ
//////////////////////////////////////////////////////////
// DrawApp
// =====
//
DrawApp::DrawApp () : TApplication("Sample ObjectWindows Program")
{
// Common file file flags and filters for Open/Save As dialogs. Filename and
// directory are computed in the member functions CmFileOpen, and CmFileSaveAs.
FileData.Flags = OFN_FILEMUSTEXIST | OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT;
FileData.SetFilter("All Files (*.*)|*.*|");

// INSERT>> Your constructor code here.

}
ƒ
Notice the comment regarding the placement of user-added code. AppExpert places
similar comments in many of the functions it defines. In general, you should add code at
these comment locations to complete the functionality of your application. If the need
arises, you can add code outside of these predescribed areas; however, you should
avoid modifying any of the code generated by the IDE Experts.
The DrawApp destructor is simply a place holder. The next code of interest is the
InitMainWindow function definition. Primarily, this function instantiates the

66 User’s Guide
SDIDecFrame class and sets the instance to be the application’s main window. The call to
the constructor for SDIDecFrame passes a zero as the client window pointer.
ƒ
DrawApp::~DrawApp ()
{
// INSERT>> Your destructor code here.
}

//////////////////////////////////////////////////////////
// DrawApp
// =====
// Application intialization.
//
void DrawApp::InitMainWindow ()
{

SDIDecFrame *frame = new SDIDecFrame(0, GetName(), 0, false);

nCmdShow = nCmdShow != SW_SHOWMINIMIZED ? SW_SHOWNORMAL : nCmdShow;


ƒ
Taking a look at the constructor for SDIDecFrame, you’ll see that the it allocates an
instance of DrawWindow, and sets the instance to be its client window if no other is
passed to it. Again, the destructor for SDIDecFrame is only a placeholder.
ƒ
//{{SDIDecFrame Implementation}}

SDIDecFrame::SDIDecFrame (TWindow *parent, const char far *title, TWindow *clientWnd,


bool trackMenuSelection, TModule *module)
: TDecoratedFrame(parent, title, clientWnd == 0 ? new DrawWindow(0, "") : clientWnd,
trackMenuSelection, module)
{
// INSERT>> Your constructor code here.
}

SDIDecFrame::~SDIDecFrame ()
{
// INSERT>> Your destructor code here.
}
ƒ

The client window


The window class that AppExpert creates is DrawWindow. This class is defined in
drawwndw.h and DRAWWNDW.CPP. By viewing this code, you’ll notice that
AppExpert generates only a constructor and a destructor. The constructor performs a
single function; it calls the constructor for the base class TWindow. The DrawWindow
destructor calls Destroy as a precautionary measure. This ensures that your application
provides the proper cleanup when you terminate the program.

Chapter 4, Building applications with AppExpert 67


AppExpert options reference
This section describes the options that are available from the AppExpert Application
Generation Options dialog box, shown in 3 on page 63. Topics and options are described
in the order in which they appear in the Topics list.

Application
The options under this topic control the general look and feel of your application.
MDI (Multiple Document Interface) sets the style of your application to the multiple-
document interface model, which lets you have a number of objects open at the same
time. In this model, a single object can be simultaneously presented by different views,
different objects can be presented by the same view class, or different objects can be
presented by entirely different views. The Turbo C++ IDE is an example of an MDI
application.
SDI (Single Document Interface) sets the style of your application to the single
document-interface model. This model lets you open only one object at a time. If you
open a new object while another is already open, the document manager attempts to
close the first object before opening the new one. The Notepad is an example if an SDI
application.
Dialog Client generates an application that uses a dialog box as the main user interface.
In this model, the client window is a dialog box. The Turbo Debugger TDWINI.EXE
utility is an example of a Dialog Client application.
Document/View check box determines whether your application supports the
Document/View model for handling application objects. The “document” is the data
and the “view” is the user interface to the data. In a Document/View model, these two
are separate (see the ObjectWindows Programmer’s Guide for more information on
Document/View). You can use this option with either MDI, SDI, or Dialog Client
applications.
Toolbar places a toolbar at the top of the main window of your application.
Status Line places a status bar at the bottom of the main window of your application
and generates code to display help hints in the status line when menu and toolbar items
are highlighted.
Drag/Drop supports Windows standard drag-and-drop actions.
Printing supports printing-related activities, and creates the File menu commands Print
Setup, Print Preview, and Print.

Basic Options
The Basic Options settings let you specify where generated code is stored, whether to
include online Help support, the startup state of your application, and the type of
controls you want to use.

68 User’s Guide
Target Name defines the name of the project and sets the base name for the other files in
your project (header files, class database, application class, and source files names are
based on the name in this field).
Base Directory sets the base directory path for your project. All paths in the project are
relative to this directory. You can choose a directory by typing it yourself, or by selecting
one with Browse. The name of this directory is passed to the Project Manager for the
new AppExpert target. The default value for this field is taken from your entry in the
New AppExpert Project dialog box. If you add an AppExpert target to an existing
project, the default value for Base Directory is taken from the existing project. If you
specify a new directory in this field, AppExpert creates the directory.
Include Help File Support, when checked, causes AppExpert to generate Help source
files (.RTF) and a Help project file (.HPJ). The Help project file is added to the Project
Manager project and automatically built with the target application. The Help source
file contains placeholder text for the menu items in the application.
Help File Name names the help files (.HLP and .HPJ) associated with your application.
The Application Startup State radio buttons specify the initial state of the application’s
main window, as follows:
• Normal (Sizeable) (default) specifies that the program starts in the default size
defined by WS_NORMAL.
• Minimized (Iconic) starts your application as an icon on the Windows desktop.
• Maximized (Entire Screen) starts your program filling the entire Windows desktop.
The Control Style radio buttons specify which type of controls the application uses:
• Standard Windows (default) uses standard Windows controls.
• Borland BWCC uses the Borland Windows Custom Controls.
• MS Control 3D uses the three-dimensional Windows controls.

OLE 2 Options
The OLE 2 Options specify the level of OLE 2 support you want with your application.
Use the following OLE 2 Container options to specify whether you want to generate an
OLE 2 container application:
Application Is Not An OLE 2 Container (default) specifies that your application is not
an OLE 2 container.
Application Is An OLE 2 Container specifies that your application is an OLE 2
container.
Use the following OLE 2 Server Options to specify the type of OLE 2 server application
you want to generate:
Application Is Not An OLE 2 Server (default) specifies that the application is not an
OLE 2 server.
Application Is An OLE 2 Server DLL specifies a .DLL OLE 2 server.

Chapter 4, Building applications with AppExpert 69


Application Is An OLE 2 Server EXE specifies an .EXE OLE 2 server.
Enable Automation In The Application specifies this application is now capable of
exposing objects for OLE 2 automation. For best results, use ClassExpert to select the
objects to expose for automation.
Server ID generates a unique OLE 2 GUID or USID server identification number.
Although you can edit this field, it’s best to let the system generate the number for you.

Code Gen Control


Code Gen Control options name various elements of the code-generation process, and
let you specify where to store the generated code.
Target Name displays the name of the project, as defined in Basic Options|Target.
Base Directory displays the base directory for the project, as defined in Basic Options|
Base Directory.
Source Directory lets you specify the directory for the application source files. This path
is relative to the directory specified as the Base Directory (see the Basic Options topic). If
supply an absolute path, it’s converted to a path relative to the Base Directory (you can’t
specify another drive). You can choose a directory by typing it or by using Browse to
select one. The default value for the Source Path is “.\” (which is the Base Directory).
Header Directory lets you specify the directory for the application header files. This
path is relative to the directory specified as the Base Directory. If you supply an absolute
path, it’s converted to a path relative to the Base Directory (you can’t specify another
drive). The default value for the Header Path is “.\” (which is the Base Directory).
Main Source File names the main application source file.
Main Header File names the main application header file.
Application Class specifies the class that AppExpert derives from TApplication. The
default class name is based on the project name.
About Dialog Class specifies the class that AppExpert derives from TDialog. The
default class name is based on the project name.
Comments documents the generated code partially (terse) or fully (verbose).

Admin Options
Admin Options define general information about the application. Some of this
information is placed in a comment block at the beginning of the files generated by
AppExpert. In addition, AppExpert uses some of the information in the application’s
Help|About dialog box.
Version Number sets the project version number that displays in the Help|About
dialog box (the default version number is “1.0”). This information is stored in the .RC
file for your project.
Copyright defines the copyright information that displays in the Help|About dialog
box.

70 User’s Guide
Description describes the application and displays the text in the application’s Help|
About dialog box. The default value is the project name.
Author names the programmer(s) who generate the source code and is used to
comment the generated code.
Company names the programmers’ company and is used to comment the generated
code.

Main Window
Main Window options control the features and type of your application’s main
window.
Window Title names the text for the title bar of the application’s main window.
Background Color sets the background color of the application’s main window; click
Set Background Color to select a color.

Basic Options
Basic Options control the general appearance of the application’s main window. The
Window Styles check boxes control the appearance of the non-client areas of your
application’s main window. See CreateWindow in the API online Help for more
information.
Caption creates a single, thin border and a title bar where a caption can be displayed.
Border puts a single, thin border without a title bar around the main window.
Max Box adds a maximize box to the right of the main window title bar. This option is
relevant only if the Caption option is on.
Min Box adds a minimize box to the right of the main window title bar. This option is
relevant only if the Caption option is on.
Vertical Scroll adds a vertical scroll bar to the right of the main window.
Horizontal Scroll adds a horizontal scroll bar at the bottom of the main window.
System Menu adds a control-menu box to the left of the main window title bar. This
option is relevant only if the Caption option is on.
Visible makes the main window visible at startup. When Visible is off, the WS_VISIBLE
style is changed to NOT WS_VISIBLE.
Disabled disables the main window at startup (the application displays as an icon when
started).
Thick Frame puts a double border on the main window and makes the main window
resizable.
Clip Siblings protects the siblings of the child windows. Painting is restricted to that
window (see WS_CLIPSIBLINGS in the API online Help).
Clip Children protects child windows from being painted over by the application’s
main window (see WS_CLIPCHILDREN in the API online Help).

Chapter 4, Building applications with AppExpert 71


SDI Client
SDI Client defines the class that represents the client window of the Single Document
Interface frame.
Client/View Class names the class of the SDI client area window or view. The
interpretation of this value depends on whether you selected Document/View in the
Application Model settings. If Document/View is selected, Client/View Class specifies
the default view class. If Document/View is not selected, Client/View Class selects the
class of the client window.

Document/View on Document/View off


TEditView (default) TEditFile (default)
TListView TListBox
TWindowView TWindow

Document Class (TFileDocument by default) names the class of the default document
(available only if Document/View is on).
Description describes the class of files associated with the Document/View. The default
value is All Files (*.*).
Filters (*.* by default) lets you specify the file specifications of the files you want the
application to recognize. You can specify multiple files (separate the entries with
semicolons) and use wildcards for file masks. These values are passed to the Windows
common-file dialog boxes, and define the file filters they display.
Default Extension is the default file-name extension that is passed to Windows
common-file dialog boxes where it is added to file names when no extension is given. It
is also used as the default extension in the File|Open and File|Save dialog boxes.
Note The Description, Filters, and Default Extension settings affect only the File|Open and
File|Save dialog boxes of the application.
Class Name is the name that AppExpert uses for the class that represents the client area
of the SDI frame window. By default, AppExpert names this class
<TargetName><ClientClass>. AppExpert derives this class from the class specified in the
Client/View Class text box.
Source File is the name of the source file that implements the class named in the Client/
View Class text box. AppExpert names this file <TargetName><ClientClass>.CPP by
default (if needed, AppExpert shortens the project name to limit the file name to eight
characters).
Header File is the name of the header file that defines the class named in the Client/
View Class text box. AppExpert names this file <TargetName><ClientClass>.h by default
(if needed, AppExpert shortens the project name to limit the file name to eight
characters).

MDI Client
The MDI Client settings define the client window class of a multiple-document interface
frame. (An MDI application displays most of its data in the client windows of the MDI

72 User’s Guide
child. See the following section “MDI Child/View” for more information.) These
options are relevant only if you choose the MDI setting of the Application|Basic
Options topic.
Client Class specifies the name that AppExpert uses for the class derived from
TMDIClient, which represents the client area of the MDI frame window. By default,
AppExpert names this class <TargetName>MDIClient.
Source File names the source file that stores the implementation of the class named in
Client Class. The default value is <ClientClass>. CPP. If needed, AppExpert shortens the
file name to eight characters.
Header File names the header file that stores the definition of the class named in Client
Class. The default value is <ClientClass>.h. If needed, AppExpert shortens the file name
to eight characters.

Dialog Client
Dialog Client options describe the class that defines the client window of the main
dialog box of your application.
Client Class specifies the name that AppExpert uses for the class derived from
TMDIClient that represents the client area of the dialog frame window. The default
value is <TargetName>TDLGClient.
Source File names the source file that stores the implementation of the class named in
Client Class. The default value is <ClientClass>TDLGC.CPP. If needed, AppExpert
shortens the file name to eight characters.
Header File names the header file that stores the definition of the class named in Client
Class. The default value is <ClientClass>tdlgc.h. If needed, AppExpert shortens the file
name to eight characters.
Dialog ID specifies the identifier of the dialog box that functions as the main window of
your application.
Include A Menu Bar specifies if you want a menu bar on the main window of your
application.

MDI Child/View
MDI Child/View options define the class for child window or Document/View
(available if MDI and Document/View from Application Model settings are selected).
MDI Child Class names the class derived from TMDIChild that represents the frame of
the default MDI child windows. The default name is <TargetName>MDIChild.
Source File is the source file that stores the implementation of the class named in MDI
Child Class. The default value is <MDIChild>1.CPP. If needed, AppExpert shortens the
file name to eight characters.
Header File is the header file that stores the definition of the class named in MDI Child
Class. The default value is <MDIChild>1.h. If needed, AppExpert shortens the file name
to eight characters.

Chapter 4, Building applications with AppExpert 73


Basic Options
Basic Options define the default MDI child window.
MDI Client/View Class names the class of the default MDI view. The interpretation of
this value depends on whether you check the Document/View setting in the
Application topic:

Document/View on Document/View off


TEditView (default) TEditFile (default)
TListView TListBox
TWindowView TWindow

Document Class, available only if your application supports Document/View, names


the class of the document in the default Document/View (TFileDocument by default).
Description describes the class of files associated with the Document/View. The default
value is All Files (*.*).
Filters (*.* by default) lets you specify the file specifications of the files you want the
application to recognize. You can specify multiple files (separate the entries with
semicolons) and use wildcards for file masks. These values are passed to the Windows
common-file dialog boxes, and define the file filters they display.
Default Extension is the default file-name extension that is passed to Windows
common-file dialog boxes where it is added to file names when no extension is given. It
is also used as the default extension in the File|Open and File|Save dialog boxes.
Note The Description, Filters, and Default Extension settings affect only the File|Open and
File|Save dialog boxes of the application.
Class Name is the name that AppExpert uses for the class that represents the client area
of the MDI frame window. By default, AppExpert names this class
<TargetName><ClientClass>. This class is derived from the class specified in the MDI
Client/View Class text box.
Source File is the name of the source file that implements the class named in the MDI
Client/View Class text box. By default, AppExpert names this file
<TargetName><ClientClass>.CPP (if needed, AppExpert shortens the project name to
limit the file name to eight characters).
Header File specifies the name of the header file that defines the class named in the MDI
Client/View Class text box. AppExpert names this file <TargetName><ClientClass>.h by
default (if needed, AppExpert shortens the project name to limit the file name to eight
characters).

74 User’s Guide
Chapter

Modifying applications with


Chapter 5
5
ClassExpert
ClassExpert works with the applications that you create with AppExpert. ClassExpert
lets you create new classes, edit and refine the implementation of classes, and navigate
through the source code for existing classes. You can also use ClassExpert with Resource
Workshop to associate classes with resources (for example, you can associate a TDialog
class with a dialog resource). In addition, ClassExpert displays virtual functions and
events for existing classes, and it checks the virtual functions implemented in your
application.

Starting ClassExpert
To start ClassExpert, choose Project|Open Project, then open a project that was
generated by AppExpert. Then, double-click the target node of your AppExpert project
(ClassExpert is the default viewer for AppExpert targets) or choose View|ClassExpert.
ClassExpert appears, listing the classes and their implementation for your application.
Figure 5.1 ClassExpert

Events pane

Classes pane

Edit pane

Chapter 5, Modifying applications with ClassExpert 75


ClassExpert basics
The ClassExpert window consists of three independent panes: the Classes pane, the
Events pane, and the Edit pane. You can size the individual panes by dragging their
borders. If you resize the ClassExpert window, the panes retain their relative
proportions.

Classes pane
The Classes pane lists the set of classes that ClassExpert manages for the currently
selected AppExpert target in the Project Manager. ClassExpert manages all classes
generated by AppExpert, and any classes that you have been added with ClassExpert.
Information displayed in the Events and Edit panes depends on the class you select in
the Classes pane. To display the class constructor source code in the Edit pane, double-
click a class in the Classes pane.
Use the Classes pane SpeedMenu (right-click the Classes pane) to add classes, automate
a class, view class options, associate document classes with view classes, view and
modify the class source code or header file, and start Resource Workshop (by choosing
Edit Dialog or Edit Menu). See online Help for details on the Classes pane SpeedMenu
commands.

Events pane
The Events pane lists Windows messages, command and control notifications, virtual
functions, and automations of the class selected in the Classes pane. The actual list
depends upon the derivation (the base class) of the selected class.
Use the Events pane SpeedMenu (right-click the Events pane) to add or delete event
handlers, virtual functions, and instance variables. You can also start Resource
Workshop with the Edit Menu and Edit Dialog commands. See online Help for details
on the Events pane SpeedMenu commands.

Edit pane
The Edit pane is an editor that displays the source file associated with the class that you
select in the Classes pane. The Edit pane works the same as the IDE editor, except you
can’t split panes or open other files in the Edit pane. If you customize the IDE editor,
those changes are also reflected in the Edit pane.
Use the Edit pane SpeedMenu (right-click the Edit pane) to access frequently used
ClassExpert commands, such as opening source files, browsing object, setting
breakpoints, and so on. A special Edit Pane SpeedMenu command, Use Class, causes
ClassExpert to generate the code that instantiates a new class that you’ve added to your
application. See online Help for details on the Edit pane SpeedMenu commands. You
can also use the IDEs Edit menu to access additional edit commands.

Adding a class
ClassExpert lets you add ObjectWindows-based classes and supports one level of
inheritance. If you need to add more derivations, you must do so manually.

76 User’s Guide
To add a class,
1 Open the Classes SpeedMenu by right-clicking the pane.
2 Choose Add New Class, or click the SpeedBar button. The Add New Class dialog box
appears.
Figure 5.2 Add New Class dialog box

3 Set the options in this dialog box as follows:


• Base Class is the ObjectWindows base class you want your class derived from.
• Class Name is the name you want to give to the new class.
• Source File is the file name that contains the source code to the class. The file
indicates should be located in the source directory of the project.
• Header File is the name of the header file that defines the class. This file defaults to
the source file name but uses the extension .h.
• Show All OWL Classes, when enabled, displays all available ObjectWindows
classes in the Base Class combo box. This allows you to select from the non-GUI
classes that are not derived from either TEventHandler or TWindow.
4 Set the following options according on your Base Class selection:
• Resource Id displays if your Base Class entry is TDialog. Use Resource Id to
specify the dialog template associated with TDialog. The Resource Id combo box
contains IDs for all the current dialog resources in your application. If you specify
an ID that doesn’t exist, ClassExpert creates an empty dialog template with the
identifier you specify (for consistency, use the prefix IDD_). ClassExpert then
loads Resource Workshop so you can define the dialog box.
• Class Client displays if your Base Class selection is TFrameWindow or a
TFrameWindow-derived class. Choose an existing class in the Client Class combo
box to represent the client area of the new frame window. Note that this is the only
value that you can change after you create the class.
• Set Window Properties displays if Base Class is TWindow or a TWindow-derived
class. When you choose the Set Window Properties button, the Window Styles
dialog box appears, from where you can set the window properties (such as the
window color, border, caption, and so on) of the new frame window. See the

Chapter 5, Modifying applications with ClassExpert 77


“Main Window” on page 71 for information on the individual window options.
Choose OK when you’re done.
5 Choose OK again to add the new class and have ClassExpert add a source node to the
project tree.

Creating document types


When you create an application that supports Document/View, you can use
ClassExpert to create view classes and document types.
To create a document type,
1 Using AppExpert, create a class for the view (unless you want to use one of the three
predefined view classes TEditView, TListView, or TWindowView).
2 In ClassExpert right-click the Classes pane, then choose View Document Types from
the SpeedMenu.
3 Select a view class (if you created your own class, it appears in this list). The default
view classes are
• TEditView provides a view wrapper for ObjectWindows text edit class.
• TListView provides views for list boxes.
• TWindowView provides window-based views.
4 Use the Description text box to describe the class of files associated with the Files Of
Type lists that appear in Windows common file dialog boxes. The default value is All
Files (*.*). The value you specify serves as the description for the value entered in
Filters.
5 Use Filters to list wildcard file specifications (separate different filters with a comma).
The filters you specify are passed to Windows common file dialog boxes to filter the
files that appear in those dialog boxes. For example, if you’re creating a document
type for bitmaps, you might have a filter *.BMP. The default value for this field is *.*,
and the value entered in Description serves as an explanation of this value.
6 Use Default Extension to specify the default file-name extension. This value is passed
to Windows common file dialog boxes and added to file names that do not have
extensions. The default value is TXT.
7 Click the Style’s button to set styles for the Document/View. The styles you can
choose are as follows (see the ObjectWindows documentation for more information):
• dtAutoDelete deletes the document object when the last view is closed.
• dtNoAutoView doesn’t automatically create a default view type.
• dtSingleView provides a single view for each document.
• dtAutoOpen opens a document when it’s created.
• dtUpdateDir updates the directory with the dialog directory.
• dtHidden hides the template from the list of user selections.
• dtSelected indicates the last selected template.

78 User’s Guide
• dtReadOnly checks the read-only check box when the dialog box is created.
• dtOverWritePrompt asks users if it’s OK to overwrite an existing file when they use
the Save As dialog box.
• dtHideReadOnly hides the read-only check box.
• dtPathMustExist lets the user type only existing paths.
• dtFileMustExist lets the user type only existing file names.
• dtCreatePrompt prompts the user before creating a new document.
• dtNoReadOnly returns the specified file as writable.
8 Click Add to add the document type to your application (this updates a data
structure in the main source file that describes all available document types). The
Document/View appears in the list of existing types.
9 Repeat steps 1–8 for any additional document types you want to add. When you’re
finished, choose Close to return to ClassExpert.

Adding and deleting event handlers


To add a handler for an event,
1 In the Classes pane, select the class for the event handler. The events appear in the
Events pane.
2 Select the event to handle (you might have to expand the list of events), then right-
click the event to view the SpeedMenu.
3 Choose Add Handler from the SpeedMenu.
• If you add a handler for a Windows message, ClassExpert adds an entry to the
response table whose name is defined by default. The function associated with the
handler appears in the Edit pane with the appropriate default handling code defined.
• If you add a handler for a virtual function, the function associated with the handler
appears in the Edit pane with the appropriate default handling code defined.
• If you add a handler for either command or control notifications, ClassExpert
prompts you for the function name before adding the entry to the response table.
Note The Add Handler SpeedMenu command is applicable only for events that are not
already handled by a member function of the selected class. Unhandled events and non-
overridden virtual functions do have a check mark next to them in the Events pane (the
Events pane marks handled events with a check mark). A lighter gray check mark
means that some events under the event category are handled (expand the list to view
the all the actual events).
To delete a handler for an event,
1 In the Classes pane, select the class for the message handler. The events appear in the
Events pane.
2 Select the check-marked event with the handle you want to remove (you might have
to expand the list of events), then right-click the event to view the SpeedMenu.

Chapter 5, Modifying applications with ClassExpert 79


3 Choose Delete Handler. ClassExpert deletes the handler from the Events pane, but
the code that implements the function is not deleted. ClassExpert notifies you of this
and you have to manually remove the function code. The code for the handler
appears in the Edit pane, so you can delete it. If you delete the function, remove the
function definition from the header file (you can choose Edit Header from the Classes
pane SpeedMenu to view the file). If you delete an event, command, or control
notification, ClassExpert removes the associated response table entry.

Adding and deleting instance variables


Instance variables let you handle many controls easily. When you create instance
variables, ClassExpert adds a transfer buffer to your code. This transfer buffer collects
information at run time, so you can use the information in the transfer buffer instead of
creating code that checks whether each check box is enabled. For example, if you have a
dialog box that has six check-box controls, and you want your application to do
something based on which boxes are checked, you can use instance variables for each
control, then use the transfer-buffer data in your code. Consult the ObjectWindows
Programmer’s Guide for more information on transfer buffers and instance variables.
To add (associate) an instance variable to a control,
1 Right-click the control notification in the Events pane, then choose Add Instance
Variable from the SpeedMenu (you might need to expand the list of control
notifications to view the control you need to modify).
2 In the Add Instance Variable dialog box, type a name for the variable. ClassExpert
adds the following to your application code:
• In the header file, it adds a structure declaration with an entry for the instance
variable.
• In the .CPP file, the instance variable is allocated in the class constructor (this
allocates the ObjectWindows class with the resource object).
• In the .CPP file, a static instance of the transfer structure is declared.
3 Choose OK. The Control Notifications in the Events pane displays the class and name
of the instance variable you just created.
To delete an instance variable,
1 Select the control with the instance variable you want to delete.
2 Right-click the control and choose Delete Instance Variable from the SpeedMenu.
3 ClassExpert deletes the following from your code:
• The entry from the structure
• The pointer variable in the class declaration
• The allocation of the class variable associated with the resource control in the
constructor
If you delete all instance variables from your code, you’ll be left with an empty
structure and the call to set the transfer buffer. Because this information doesn’t affect
the rest of your code, you don’t need to delete it manually.

80 User’s Guide
Jumping to class source code
To view the source code for a class, select the class in the Classes pane (click the class
name once). The code appears in the Edit pane. If you move the insertion point in the
Edit pane, ClassExpert remembers the position the next time you select the class.
To move the insertion point to the class constructor code, double-click the class name in
the Classes pane. To jump to a handled event, double-click the event in the Events pane.
You can also view the source file or its header file in an IDE editor:
1 Right-click a class in the Classes pane to open the SpeedMenu.
2 Choose Edit Source to view the source .CPP file for the class constructor, or choose
Edit Header to view the header file where the class is defined.

Using Resource Workshop with ClassExpert


Resource Workshop is the default viewer for resource scripts (.RC files). When you start
Resource Workshop from ClassExpert (by choosing Edit Dialog or Edit Menu from a
SpeedMenu), Resource Workshop automatically loads the RC script for that application.
When using Resource Workshop with AppExpert-generated code, you should always
run it from ClassExpert because Resource Workshop and ClassExpert update each other
as you make changes to the project. When you start Resource Workshop, it checks the
resource code for changes and sends updates immediately to ClassExpert. For example,
if you add a button to a dialog box, Resource Workshop tells ClassExpert, which then
adds the control to the Events pane. To view the control in ClassExpert, select the
control in Resource Workshop, right-click, then choose ClassExpert from the
SpeedMenu. Resource Workshop returns you to ClassExpert with the control
highlighted in the Events pane.

Running Resource Workshop from the IDE


When you start Resource Workshop as a viewer for an application (either through the
Project Manager in the IDE or through ClassExpert), its behavior differs from running
Resource Workshop separately:
• When you make changes in Resource Workshop that affect the class structure or
functionality (such as editing menus or dialog boxes), those changes are instantly
updated in the window.
• You can’t open another script (no File|Open or File|New).
• If you close the IDE, Resource Workshop is also closed and any changes you made
are automatically saved.
• If you close the project file that started Resource Workshop, Resource Workshop is
also closed.
• If you build a project while Resource Workshop is open, it creates a .RES file based on
the resources loaded. For example, if you edit a dialog box, but haven’t saved it, the
.RES file will reflect the unsaved edits.

Chapter 5, Modifying applications with ClassExpert 81


• You can access the IDE from Resource Workshop using the SpeedMenu (right-click)
and choosing ClassExpert.

Using Rescan
Rescan is a special project tool that examines the source code listed in the .IDE file of
your AppExpert project and updates or rebuilds the project database (the .APX file)
according to what it finds in the source code. Rescan looks for special markers in the
source code to reconstruct the .APX database file and then starts Resource Workshop to
reconstruct information about project resources. If Rescan is successful, the original
project database file is renamed to *.~AP and a new database file is created; otherwise,
the original database is left as *.APX.
You can use Rescan to
• Delete a class
• Move a class from one source file to another
• Rename a class, handler, instance variable, or dialog ID
• Import a class from another project
• Rebuild a lost or damaged project database (*.APX) file

Deleting a class
To delete a class,
1 Remove the class source node from the project by right-clicking the node in the
Project Manager, then choosing Delete Node. If the class shares a source file with
other classes, delete the code related to the class from the source file, then delete
references to the class from the other source files.
2 Right-click the AppExpert target in the Project Manager, then choose Special|Rescan.
Rescan scans the source files listed as dependencies for the AppExpert target.
Resource Workshop scans and updates the resource files. When Rescan is complete,
you’ll return to the updated project file where you can either build your application
or use. You can add the deleted class to the project by adding the class source file as a
dependent of the target, then rescanning.

Moving a class
To move a class from one source file to another,
1 Move (cut and paste) the source code of the class to the new file. If the new file isn’t in
the project as a node under the target, add the node to the project. If the moved class
was its own source file, you can delete that empty source file from the project.
2 Right-click the target in the Project Manager, then select Special|Rescan. When
Rescan finishes, it returns you to the Project window in the IDE.

82 User’s Guide
Renaming an element
To rename a class, an event handler, an instance variable, or a dialog ID,
1 Use the IDE editor to search and replace all occurrences of the original name with the
new name. Be sure to check all source files associated with the project (.CPP, .h, .RC,
and .RH files).
2 From the Project Manager, right-click the target node, then choose Special|Rescan.
When Rescan completes, it returns you to the Project Manager.
Note After renaming an element, verify that the #include, #ifdef, and #define statements
generated by AppExpert are still valid. These statements can become corrupted as
ClassExpert searches and replaces the class names within your source files.

Importing a class
To import a class from one project to another,
1 Move or copy the source and header file that defines the class to the source and
header directory of the new project. All source files for a project must be in the
project’s source directory (.CPP files) or header directory (.h files). These directories
were created when you first generated the AppExpert project.
2 Add the class source file as a dependent node under the target in the IDE project (use
Add node from the SpeedMenu).
3 Add the header file that contains the class definition as a dependent node under the
class source file in the AppExpert project (use Add Node from the SpeedMenu).
4 In the Project window, right-click the AppExpert target, then choose Special|Rescan.

Rebuilding the .APX database file


To rebuild a lost or damaged database file (the .APX file),
1 Open the project file that contains the AppExpert target and dependent nodes (this is
the .IDE file).
2 Right-click the AppExpert target, then choose Special|Rescan from the SpeedMenu.
Rescan automatically creates a new database file using markers from the source code
for the application.

Chapter 5, Modifying applications with ClassExpert 83


84 User’s Guide
Chapter

Browsing classes and objects


Chapter 6
6
The IDE contains a browser that lets you view the classes, functions, variables, and
constants in your .EXEs and .DLLs. In addition to this, the browser also lets you
• Graphically view the class hierarchies used in your application
• View the functions and symbols contained in and inherited by an object
• List the global symbols defined in your program
• List all references to a variable in your program
• View and edit the declaration of a variable

Generating browser information


Before you can access the browser, you must compile your project with browser reference
information. To generate symbolic browser information,
1 Open the project which you want to browse.
2 Choose Options|Project and set the following options in the Project Options dialog
box:
• Under the Compiler|Debugging topic, check both Debug Information In OBJs
and Browser Reference Information In OBJs.
• Under the Linker|General topic, check Include Debug Information.
3 Compile and link the project.
After you compile the project with browser reference information, choose one of the
following commands to access the browser:
• Search|Browse Symbol
• View|Classes
• View|Globals

Chapter 6, Browsing classes and objects 85


You can also place your cursor on a symbol in your code and choose Search|Browse
Symbol to open the browser.
If you try to browse a class definition (or any symbol that doesn’t have symbolic debug
information), you’ll get an error message.

Browsing objects (class overview)


Choose View|Classes to see the “big picture,” the object hierarchies in your application,
as well as the small details. When you choose View|Classes, the browser draws your
objects and shows their ancestor-descendant relationships in a horizontal tree. The red
lines in the hierarchy diagram help you see the immediate ancestor-descendant
relationships of the currently selected object more clearly. Figure 6.1 shows the class
hierarchy from the AppExpert Draw application created in Chapter 4.
Figure 6.1 Viewing classes in an application

To see more information on a particular object, double-click it. If you aren’t using a
mouse, select the object by using your arrow keys and press Enter.

Browsing global and local symbols


Choose View|Globals to open a window that lists every global symbol in your
application in alphabetical order. The browser also lists the symbols (the functions,
variables, and so on) used in a particular object.
Use one of these methods to see the declaration of a particular symbol displayed in a list:
• Double-click the symbol.
• Select the symbol and press Enter.
• Select the symbol, press Alt+F10 to view the SpeedMenu, then choose Browse Symbol.
The symbol declaration appears in a window, as shown in Figure 6.2.

86 User’s Guide
Figure 6.2 Symbol declaration window

You can also browse any symbol in your code without viewing object hierarchies or lists
of symbols first. Choose from these methods:
• Highlight the symbol in your code and choose Search|Browse Symbol.
• Click the right mouse button or press Alt+F10 when an Edit window is selected to
display the SpeedMenu, then choose Browse Symbol.

Configuring the browser display


You can check the Browser options in the Environment Options dialog box to select the
type of symbols you want to view, but you must set these options before opening the
browser.
When you browse the program global variables, or a particular symbol, the same letters
that identify the symbol appear in a Filters matrix at the bottom of the window. You can
use filters to select the type of symbols you want to see listed. (See Table 6.1 for a list of
letters and their meaning.)
Table 6.1 Filter letters in the browser
Letter Symbol
F Functions
T Types
V Variables
C Integral constants
? Debuggable
I Inherited from an ancestor
v Virtual method

The Filters matrix has a column for each letter. Click the top or bottom row to turn on
and off the display of that particular item (a letter in the top row means the browser
shows symbols with that identification; a letter on the bottom means the browser
excludes symbols with that identification). For example, to remove all the variables
displayed in the currently selected object, click the bottom cell in the V column to move
the V to the bottom of the Filters matrix.

Chapter 6, Browsing classes and objects 87


One or more letters appear to the left of each symbol in the object listing. The letters
describe the type of the symbol. Letters that appear after the first letter (which identifies
the symbol type) further describe the symbol.

Using regular expressions with global symbols


You can use regular expressions when you search for global symbols (for example, you
can use ?, * and +). To get more information on a particular symbol, either click the
symbol or use your cursor keys to select it. A Search input box at the bottom of the
window lets you quickly search through the list of global symbols by typing the first
few letters of the symbol’s name. As you type, the highlight bar in the list box moves to
a symbol that matches the typed characters. You can view the symbol declaration by
selecting the symbol and pressing Enter. See Table 6.2 for a list of the regular expression
symbols allowed.
Table 6.2 Browser search expressions
Character Function
. (a period) Matches one of any character.
* Matches zero or more of the previous character. For example:
* is an error because there is no previous character.
mo* matches “mo,” “moo,” “mooo,” and so on.
bo*x matches “box,” ”boox,” “booox,” and so on.
+ Matches one or more of the previous character. For example:
+ is an error.
mo+ matches “moo,” “mooo,” and so on.
bo+x matches “boox,” “booox,” and so on.
? Matches zero or one of the previous character. For example:
? is an error.
mo? matches “m” or “mo” only.
bo?x matches “bx” or “box” only.

Customizing the browser


You can set several browser options using the Environment Options dialog box. Choose
Options|Environment, click the Browser topic and select the options you want to use.
Single window means you can have only one browser window up at a time; Multiple
windows opens a new browser window each time you perform a browsing action (such
as choosing View|Globals from the main menu). The browser also has a customizable
SpeedBar (see page 16 for more information on customizing SpeedBars).

88 User’s Guide
Chapter

Using the integrated debugger


Chapter 7
7
No matter how careful you are when you write code, a newly-completed program is
likely to contain errors, or bugs, that prevent it from running the way you intended it to.
Debugging is the process of locating and fixing the errors in your programs.
The Turbo C++ IDE contains an integrated debugger that lets you debug programs from
within the IDE. Among other things, the integrated debugger lets you control the
execution of your program, inspect the values of variables and items in data structures,
modify the values of data items while debugging. You can access the functionality of the
integrated debugger through two menus: Debug and View. This chapter introduces you
to the functionality of the integrated debugger and gives a brief overview of the
debugging process.

Types of bugs
The integrated debugger can help find two basic types of programming errors: run-time
errors and logic errors.

Run-time errors
If your program successfully compiles, but fails when you run it, you’ve encountered a
run-time error. Your program contains valid statements, but the statements cause errors
when they’re executed. For example, your program might be trying to open a
nonexistent file, or it might be trying to divide a number by zero. The operating system
detects run-time errors and stops your program execution if such an error is
encountered.
Without a debugger, run-time errors can be difficult to locate because the compiler
doesn’t tell you where the error is located in your source code. Often, the only clue you
have to work with is where your program failed and the error message generated by the
run-time error.

Chapter 7, Using the integrated debugger 89


Although you can find run-time errors by searching through your program source code,
the integrated debugger can help you quickly track down these types of errors. Using
the integrated debugger, you can run to a specific program location. From there, you
can begin executing your program one statement at a time, watching the behavior of
your program with each step. When you execute the statement that causes your
program to fail, you have pinpointed the error. From there, you can fix the source code,
recompile the program, and resume testing your program.

Logic errors
Logic errors are errors in design and implementation of your program. Your program
statements are valid (they do something), but the actions they perform are not the actions
you had in mind when you wrote the code. For instance, logic errors can occur when
variables contain incorrect values, when graphic images don’t look right, or when the
output of your program is incorrect.
Logic errors are often the most difficult type of errors to find because they can show up
in places you might not expect. To be sure your program works as designed, you must
thoroughly test all of its aspects. Only by scrutinizing each portion of the user interface
and output of your program can you be sure that its behavior corresponds to its design.
As with run-time errors, the integrated debugger helps you locate logic errors by letting
you monitor the values of your program variables and data objects as your program
executes.

Planning a debugging strategy


After program design, program development consists of a continuous cycle of program
coding and debugging. Only after you thoroughly test your program should you
distribute it to your end users. To ensure that you test all aspects of your program, it’s
best to have a thorough plan for your debugging cycles.
One good debugging method involves breaking your program down into different
sections that you can systematically debug. By closely monitoring the statements in each
program section, you can verify that each area is performing as designed. If you do find
a programming error, you can correct the problem in your source code, recompile the
program, and then resume testing.

Starting a debugging session


To start a debugging session,
1 Build your program with debug information.
2 Run your program from within the IDE.
When debugging, you have complete control of your program’s execution. You can
pause the program at any point to examine the values of program variables and data
structures, to view the sequence of function calls, and to modify the values of program
variables to see how different values affect the behavior of your program.

90 User’s Guide
Compiling with debug information
Before you can begin a debugging session, you must compile your project with symbolic
debug information. Symbolic debug information, contained in a symbol table, enables the
debugger to make connections between your program’s source code and the machine
code that’s generated by the compiler. This lets you view the actual source code of your
program while running the program through the debugger.
To generate symbolic debug information for your project,
1 In the Project window, select the project node.
2 Choose Options|Project to open the Project Options dialog box.
3 From the Compiler|Debugging topic, check Debug Information In OBJs to include
debug information in your project .OBJ files. (This option is checked by default.)
4 From the Linker|General topic, check Include Debug Information. This option
transfers the symbolic debug information contained in your .OBJ files to the final
.EXE file (this option is checked by default).
Adding debug information to your files increases their file size. Because of this, you’ll
want to include debug information in your files only during the development stage of
your project. Once your program is fully debugged, compile your program without
debug information to reduce the final .EXE file size.
Note Not all of the .OBJ files in your project need symbolic debug information—only those
modules you need to debug must contain a symbol table. However, since you can’t step
into a module that doesn’t contain debug information, it’s best to compile all your
modules with a minimum of line number debug information during the development
stages of your project (see page 47 for information on debugging options).

Running your program in the IDE


Once you’ve compiled your program with debug information, you can begin a
debugging session by running your program in the IDE. By running your program in
the IDE, you have control of when the program runs and when it pauses. Whenever the
program is paused in the IDE, the debugger takes control.
When your program is running under the IDE, it behaves as it normally would: your
program creates windows, accepts user input, calculates values, and displays output.
During the time that your program is not running, the debugger has control, and you
can use its features to examine the current state of the program. By viewing the values of
variables, the functions on the call stack, and the program output, you can ensure that
the area of code you’re examining is performing as it was designed.
As you run your program through the debugger, you can watch the behavior of your
application in the windows it creates. For best results during your debugging sessions,
arrange your screen so you can see both the IDE Edit window and your application
window as you debug. To keep windows from flickering as the focus alternates
between the debugger windows and those of your application, arrange the windows so
they don’t overlap (tile the windows). With this setup, your program’s execution will be
quicker and smoother during the debugging session.

Chapter 7, Using the integrated debugger 91


Specifying program arguments
If the program you want to debug uses command-line arguments, you can specify those
arguments in the IDE in the following way:
1 Choose Options|Environment, then select the Debugger topic.
2 In the Run Arguments text box, type the arguments you want to use when you run
your program under the control of the integrated debugger.

Controlling program execution


The most important advantage of a debugger is that it lets you control the execution of
your program; you can control whether your program will execute a single line of code,
an entire function, or an entire program block. By dictating when the program should
run and when it should pause, you can quickly move over the sections that you know
work correctly and concentrate on the sections that are causing problems.
The integrated debugger lets you control the execution of your program in the following
ways:
• Running to the cursor location
• Stepping and tracing
• Running to a breakpoint
• Pausing your program
When running code through the debugger, all program execution is based on lines of
source code. The integrated debugger lets you control the rate of debugging to the level
of a single line of code. However, the debugger considers multiple program statements
on one line of text to be a single line of code; you cannot individually debug multiple
statements contained on a single line of text. In addition, the debugger regards a single
statement that’s spread over several lines of text as a single line of code.

Running to the cursor location


Often when you start a debugging session, you’ll want to run your program to a spot
just before the suspected location of the problem. At that point, use the debugger to
ensure that all data values are as they should be. If everything is OK, you can run your
program to another location, and again check to ensure that your program is behaving
as it should.
To run to a specific program location,
1 In the Edit window, position the cursor on the line of code where you want to begin
(or resume) debugging.
2 Run to the cursor location in one of the following ways:
• Click the Run To Cursor button on the SpeedBar.
• Choose Run To Cursor from the Edit window SpeedMenu.
• Press F4.

92 User’s Guide
When you run to the cursor, your program executes at full speed until the execution
reaches the location marked by the text cursor in the Edit window. When the execution
encounters the code marked by the text cursor, the debugger regains control and places
the execution point on that line of code.

The execution point


The execution point marks the next line of source code to be executed by the debugger.
Whenever you pause your program execution within the debugger (for example,
whenever you run to the cursor or step to a program location), the debugger highlights
a line of code, marking the location of the execution point. The execution point always
shows the next line of code to be executed, whether you are going to trace, step, or run
your program at full speed.

Finding the execution point


While debugging, you’re free to open, close, and navigate through any file in an Edit
window. Because of this, it’s easy to lose track of the next program statement to execute,
or the location of the current program scope. To quickly return to the execution point,
choose Debug|Find Execution Point or click the SpeedBar button. Even if you’ve closed
the Edit window containing the execution point, Find Execution Point opens an Edit
window, and highlights the source code containing the execution point.

Stepping through code


The Trace Into and Step Over commands offer the simplest way of moving through
your program code. While the two commands are very similar, they offer different ways
to step through code. When you step, you watch your program execute statements one
at a time. After stepping, the program execution pauses and you can use the debugger
to investigate the different aspects of your program.

Trace Into
The Trace Into command executes a single program statement at a time. If the execution
point is located on a call to a function that was compiled with debugging information,
Trace Into causes the debugger to step into that function by placing the execution point
on the function’s first statement. However, if the execution point is located on a function
call that doesn’t contain debugging information (a library function, for example), then
Trace Into runs that function at full speed, after which the execution point is positioned
on the statement following the function call.
If the execution point is located on the last statement of a function, Trace Into causes the
debugger to return from the function, placing the execution point on the line of code
that follows the function call.
The term single stepping refers to using Trace Into to successively run though the
statements in your program code. To choose Trace Into, either
• Click the Trace Into SpeedBar button.
• Choose Debug|Trace Into.
• Press F7.

Chapter 7, Using the integrated debugger 93


The following example helps explain how single stepping works. Suppose you want to
follow the sequence of events through the following two functions contained in a bubble
sort program:
void bubble( int *ptr, int n)
{
int i, j;

for (i=0; i<n-1; i++)


for (j=i+1; j<n; j++)
order (ptr+i, ptr+j);
}

void order (int *n1, int *n2)


{
if (*n1 > *n2)
{
int temp = *n1;
*n1 = *n2;
*n2 = temp;
}
}
If you load the program into the Edit window and place the cursor on the first for
statement in the bubble function, pressing F4 runs the program to that location. Choosing
Debug|Trace Into executes that line of code, and moves the execution point to the next
line of code in the program (the second for statement). Choosing Trace Into again causes
the debugger to execute the second for statement, this time placing the execution point
on the line containing the call to the function order:
order (ptr+i, ptr+j);
Choosing Trace Into a third time calls the function order, causing the debugger to trace
into that function by placing the execution point on the first line of the function
definition:
void order (int *n1, int *n2)
From here, successive Trace Into commands execute the lines of code in that function
one at a time. When the execution point is located on the last line in the function,
stepping (with either the Trace Into or Step Over commands) causes the function to
return, which places the execution point on the statement following the function call. In
this case, the debugger returns the execution point to the second for statement in bubble.

Step Over
The Step Over command, like Trace Into, lets you execute program statements one at a
time. However, if you issue the Step Over command when the execution point is located
on a function call, the debugger runs that function at full speed (instead of tracing into
it), then positions the execution point on the statement that follows the function call.
You can choose Step Over in the following ways,
• Click the Step Over button on the SpeedBar.
• Choose Debug|Step Over.

94 User’s Guide
• Press F8.
For example, in the previous bubble sort code, choosing Debug|Step Over while the
execution point highlights the function call order causes the debugger run order at full
speed. The debugger then places the execution point on the statement following the
function call, which in this case is the second for statement in bubble.
As you debug, you can choose to trace into some functions and step over others. If you
know a function performs as it was designed, you can step over calls to that function
with confidence that the function call will not cause an error. If, on the other hand, you
aren’t sure that a function is well behaved, you can choose to trace into the function to
verify that it works as designed.

Debugging member functions and external code


If you implement classes in your C++ programs, you can still use the integrated
debugger to step and trace. The debugger handles member functions the same way it
would step over or trace through functions in a program that is not object-oriented.
You can also trace into or step over external code written in any language (including C,
C++, and Pascal) as long as the code meets all the requirements for external linking and
the linked object file contains full Borland symbolic debugging information.

Running to a breakpoint
You set breakpoints on lines of source code where you want the program execution to
pause during a run. Running to a breakpoint is similar to running to a cursor position, in
that the program runs at full speed until it reaches a certain source-code location.
However, unlike Run To Cursor, you can have multiple breakpoints in your code and
you can customize each one so it pauses the program’s execution only when a specified
condition is met. For more information on breakpoints, see “Using breakpoints” on
page 96.

Pausing the program


In addition to stepping over or tracing into code, you can also pause your program
while it’s running. Choosing Debug|Pause Program causes the debugger to pause your
program inside the window message loop. You can then use the debugger to examine
the state of your program with respect to this program location. When you’re done
examining the program, continue debugging by running as usual.
If your program assumes control and won’t allow you to return to the debugger (for
example, if it runs into an infinite loop), you can press Ctrl+Alt+SysRq to stop your
program. You might need to press this command several times before your program
actually stops—the command will not work if Windows kernel code is executing.

Terminating the program


Sometimes while debugging, you’ll find it necessary to restart the program from the
beginning. For example, you might need to restart the program if you step past the

Chapter 7, Using the integrated debugger 95


location of a bug, or if variables or data structures become corrupted with unwanted
values.
Choose Debug |Terminate Program (or press Ctrl+F2) to end the current program run
and reset the program. Terminating a program closes all open program files, releases all
memory allocated by the program, and clears all variable settings. However,
terminating a program does not delete any breakpoints or watches that you might have
set. This makes it easy to resume a debugging session.

Using breakpoints
You use breakpoints to pause your program execution at designated source code
locations during a debugging session. By setting breakpoints in potential problem areas
of your source code, you can run your program at full speed, knowing that its execution
will pause at a location you want to debug. When your program execution encounters a
breakpoint, the program pauses (before executing the line containing the breakpoint)
and the debugger displays the breakpoint line in the Edit window. You can then use the
debugger to view the state of your program.

Setting breakpoints
Breakpoints are flexible in that they can be set before you begin to run a program, or at
any time that the integrated debugger has control. For a breakpoint to be valid, it must
be set on an executable line of code (see “Invalid breakpoints” later in this section for
details).
To set a breakpoint, select the line of code in the Edit window where you want the
breakpoint set, then do one of the following:
• Click the Set Or Clear An Unconditional Breakpoint SpeedBar button.
• Press F5.
• Choose Toggle Breakpoint from the SpeedMenu.
• Choose Debug|Add Breakpoint, then choose OK in the Breakpoint Properties dialog
box to confirm the breakpoint setting.
Alternately, if you know the line of code where you want the breakpoint set, choose
Debug|Add Breakpoint and type the source-code file name and line number into the
Breakpoint Properties dialog box. When the settings in the Breakpoint Properties dialog
box are correct, choose OK to complete the breakpoint entry.
When the breakpoint is set, the line it is set on becomes highlighted.

Setting breakpoints after starting a program


While your program is running, you can switch to the debugger (just like you would
switch to any Windows application) and set a breakpoint. When you return to your
application, the new breakpoint will be set, and your application will halt when it
reaches the breakpoint.

96 User’s Guide
Invalid breakpoints
If a breakpoint is not placed on an executable line of code, the debugger considers it
invalid. For example, a breakpoint set on a comment, a blank line, or declaration is
invalid. If you set an invalid breakpoint, the debugger displays the Invalid Breakpoint
error box when you attempt to run the program. To fix the situation, close the error box
and delete the invalid breakpoint from the Breakpoints window. You can then reset the
breakpoint in the intended location. However, you can also ignore invalid breakpoints;
the IDE disables any invalid breakpoints when you run your program.

Working with breakpoints


The Breakpoints window lists all breakpoints by file name and line number, the
breakpoint state (verified, unverified, or invalid), and the pass count. The check box to
the left of a breakpoint listing indicates whether the breakpoint is enabled (a check mark
means enabled).
To open the Breakpoints window, choose View|Breakpoint.
Figure 7.1 The Breakpoints window

The Breakpoints window lets you view and maintain all your breakpoints; you don’t
need to search through your source files to find the breakpoints you’ve set. Also, using
the commands on the Breakpoints window SpeedMenu, you can view the code at any
breakpoint location.

Viewing and editing code at a breakpoint


If a breakpoint isn’t displayed in the current Edit window, you can use the Breakpoints
window to quickly find the breakpoint’s location in your source code. To do so, select
the breakpoint in the Breakpoints window, then choose View Source or Edit Source
from the SpeedMenu. The Edit window is updated to show the breakpoint’s location. If
you choose View Breakpoint, the Breakpoints window remains active so you can
modify the breakpoint or go on to view another. If you choose Edit Breakpoint, the Edit
window gains focus on the line containing the breakpoint, enabling you to modify the
source code at that location.

Disabling and enabling breakpoints


Disabling a breakpoint hides the breakpoint from the current program run. When you
disable a breakpoint, all the breakpoint settings remain defined, but the breakpoint is
hidden from the execution of your program; your program will not stop on a disabled
breakpoint. Disabling a breakpoint is useful if you have defined a conditional
breakpoint that you don’t need to use now, but might need to use at a later time.

Chapter 7, Using the integrated debugger 97


The Breakpoint window contains an Enable check box to the left of each breakpoint
listing. When you set a breakpoint, the breakpoint is enabled by default, and the check
box is checked. To disable a breakpoint, do one of the following:
• Open the Breakpoint window and uncheck the Enable check box.
• Highlight the breakpoint in the Breakpoint window and choose Disable Breakpoint
from the SpeedMenu.
You can also disable all current breakpoints by selecting the Disable All Breakpoints
SpeedMenu command. To reenable a breakpoint, recheck the Enable check box, or select
it and choose Enable Breakpoint from the SpeedMenu.

Deleting breakpoints
When you no longer need to examine the code at a breakpoint location, you can delete
the breakpoint from the debugging session. You can delete breakpoints using either the
Edit window or the Breakpoints window:
• From the Edit window, place the insertion bar on the line containing the breakpoint,
the press F5 (or choose Toggle Breakpoint from the SpeedMenu).
• From the Breakpoints window, highlight the breakpoint you want removed, and
choose the Delete Breakpoint command from the SpeedMenu. You can also delete all
current breakpoints by choosing Delete All Breakpoints from the SpeedMenu.

Modifying breakpoint properties


To view and modify the properties of a breakpoint, double-click the breakpoint in the
Breakpoints window, or select it and choose Edit Breakpoint from the SpeedMenu. The
Breakpoint Properties dialog box appears.
Figure 7.2 The Breakpoint Properties dialog box

In addition to examining a breakpoint’s properties, you can use the Breakpoint


Properties dialog box to change the location of a breakpoint, set a conditional
breakpoint, and specify an expression for a breakpoint to log to the Event Log.

98 User’s Guide
Creating conditional breakpoints
When you first set a breakpoint, by default the debugger pauses the program execution
each time the breakpoint is encountered. However, using the Breakpoint Properties
dialog box, you can customize your breakpoints so that they activate only when a
specified set of conditions is met.
The integrated debugger lets you add two types of conditions to your breakpoints:
• Boolean expressions
• Pass counts

Setting Boolean conditions


The Conditional Expression input box in the Breakpoint Properties dialog box lets you
enter an expression that will be evaluated each time the breakpoint is encountered
during the program execution. If the expression evaluates to true (or not zero), then the
breakpoint will pause the program execution. If the condition evaluates to false (or
zero), then the debugger will not stop at the breakpoint location.
Conditional breakpoints are useful when you want to see how your program behaves
when a variable falls into a certain range, or what happens when a particular flag gets
set. For example, suppose you want a breakpoint to pause on a line of code only when
the variable mediumCount is greater than 10. To do so,
1 Set a breakpoint on the desired line of code by moving the text cursor to that line of
code in the Edit window and pressing F5.
2 Open the Breakpoints window by choosing View|Breakpoint.
3 Highlight the breakpoint just set and choose Edit Breakpoint from the SpeedMenu.
The Breakpoint Properties dialog box opens.
4 Check Enable Conditional Breakpoint, then enter the following expression into the
Conditional Expression input box:
mediumCount > 10
5 Click OK to confirm your settings.
Note You can input any valid C or C++ language expression into the Conditional Expression
input box; however, all symbols in the expression must be accessible from the
breakpoint’s location and the expression cannot contain any function calls. For more on
valid debugger expressions, see “Evaluating expressions” on page 103.

Using pass counts


The Pass Count input box lets you specify a particular number of times that a
breakpoint must be passed for the breakpoint to activate; pass counts tell the debugger to
pause the program execution the nth time that the breakpoint is encountered during the
program run (the number n is user-specified, and is set to 1 by default).
The pass count number is decremented each time the line containing the breakpoint is
encountered during program execution. If the pass count equals 1 when the breakpoint

Chapter 7, Using the integrated debugger 99


line is encountered, the breakpoint activates and pauses the program execution on that
line of code.
Pass counts are useful, for example, when you think that a loop is failing on the nth
iteration. Or, if you can’t tell on which iteration the loop fails, you can set the pass count
to the maximum loop count and run your program. When the program fails, you can
calculate the number of times that the program went through the loop by examining the
number in the pass count field.
When pass counts are used in conjunction with Boolean conditions, the breakpoint will
pause the program’s execution the nth time that the condition is true; the condition must
be true for the pass count to be decremented.

Logging expressions
You can choose to have the value of a specified expression written to the Event Log
window each time a breakpoint is reached:
1 Select Log Expression in the Breakpoint Properties dialog box.
2 In the Expression To Log text box, type the expression you want evaluated.
For example, if you type my_array[y] into the Expression To Log text box, the debugger
writes the value of that expression to the Event Log window when the breakpoint
activates (in this case, the value contained in the array element y is written to the log).
For more information about the Event Log window, see “Sending messages to the Event
Log window” on page 108.

Customizing the breakpoint and execution point colors


You can customize the colors used to indicate the execution point and the enabled,
disabled, and invalid breakpoint lines:
1 Choose Options|Environment.
2 Choose Syntax Highlighting|Customize Syntax Highlighting.
3 From the Element list, select Execution Point, Enabled Break, Disabled Break, or
Invalid Break, then set the background and foreground to the colors you want. For
more about syntax highlighting, see “Syntax highlighting” on page 15.

Examining program data values


Even though you can discover many interesting things about your program by running
and stepping through it, you’ll usually need to examine the values of program variables
to uncover bugs. For example, it’s helpful to know the value of the index variable as you
step though a for loop, or the values of the parameters passed to a function call.
The integrated debugger has the following tools to help you examine the data values in
your program:

100 User’s Guide


• The Watch window
• The Expression Evaluator dialog box
• The Inspect Expression window
• The Call Stack window
• The Register window
Data evaluation operates at the level of expressions. An expression consists of constants,
variables, and values contained in data structures combined with language operators. In
fact, almost anything you can use as the right side of an assignment operator can be
used as a debugging expression, with the exception of function calls.

Watching expressions
You use watches to monitor the changing values of variables or expressions during your
program run. After you enter a watch expression, the Watch window displays the
current value of the expression. Each time your program pauses (such as when it
encounters a breakpoint), the value of the watch changes to reflect the current value of
the expression according to the values of the variables in your program.
To open the Watch window, choose View|Watch.
Figure 7.3 The Watch window

If the execution point moves to a location where any of the variables in the watch
expression are undefined, then the entire watch expression becomes undefined. If the
execution point returns to a location where the watch expression can be evaluated, then
the Watch window again displays the current value of the watch expression.
The easiest way to set a watch is from the Edit window. Highlight the expression you
want to monitor, then choose Set Watch from the Edit window SpeedMenu to add the
expression to the Watch window.
You can also create a watch using the following method:
1 Open the Watch Properties dialog box using one of these commands:
• Debug|Add Watch
• Set Watch on the Edit window SpeedMenu
• Ctrl+F5

Chapter 7, Using the integrated debugger 101


2 In the Expression text box, enter the expression you want to watch (or choose a
previously entered expression from the drop-down list).
Figure 7.4 The Watch Properties dialog box

Note You can also open the Watch Properties dialog box by double-clicking a watch in the
Watch window, or by selecting a watch in the Watch window and choosing the
SpeedMenu Edit command.

Formatting watch expressions


You can format the display of a watch expression using the Watch Properties dialog
box. By default, the debugger displays integer values in decimal form. However, by
checking the Hexadecimal button in the Watch Properties dialog box, you can specify
that an integer watch be displayed as hexadecimal. You can also vary the display of the
watches using the Display As buttons in the Watch Properties dialog box. For more on
these buttons, refer to the online Help.
To format a floating-point expression, click the Floating Point button, then indicate the
number of significant digits you want displayed in the Watch window by typing this
number in the Significant Digits text box.
If you’re setting up a watch on an element in a data structure (such as an array), you can
display the values of consecutive data elements. For example, suppose you have an
array of five integers named xarray. Type the number 5 in the Repeat Count text box of
the Watch Properties dialog box to see all five values of the array. However, to use a
repeat count, the watch expression must represent a single data element.
You can also format watch expressions using the expression format specifiers shown in
Table 7.1 on page 104. Format specifier settings override any settings specified in the
Watch Properties dialog box. Format specifiers use the following syntax:
expression [,format_specifier]

Disabling a watch
If you prefer not to watch an expression that you’ve entered in the Watch window, but
you don’t want to delete it because you might need to use it later, you can disable the
watch. Disabling watches will speed up the response of the debugger because it won’t
have to monitor the watch as you step or run through your program.

102 User’s Guide


In the Watch window, the Enable check box lies to the left of each watch listing. When
you set a watch, the debugger enables the watch by checking this box. To disable a
watch, do one of the following:
• Open the Watch window and uncheck the Enable check box.
• Highlight the watch in the Watch window and choose Disable Watch from the
SpeedMenu.
You can also disable all current watches by selecting the Disable All Watches
SpeedMenu command. To reenable a watch, recheck its Enable check box, or select it
and choose Enable Watch from the SpeedMenu.

Deleting a watch
To delete a watch expression, select the expression in the Watch window and choose
Delete Watch from the SpeedMenu.You can also delete all the watches by choosing
Delete All Watches from the SpeedMenu.
Note These commands cannot be reversed.

Evaluating and modifying expressions


You can evaluate expressions using the Expression Evaluator dialog box. The
Expression Evaluator dialog box has the advantage that it lets you change the values of
variables and items in data structures during the course of your debugging session. This
can be useful if you think you’ve found the solution to a bug, and you want to try it out
before exiting the debugger, changing the source code, and recompiling the program.

Evaluating expressions
Choose Debug|Evaluate/Modify to open the Expression Evaluator dialog box. By
default, the token at the cursor position in the current Edit window is placed in the
Expression text box. You can accept or modify this expression, enter another one, or
choose an expression from the history list of expressions you’ve previously evaluated.
Figure 7.5 The Expression Evaluator dialog box

To evaluate the expression, click the Eval button. Using this dialog box, you can
evaluate any valid language expression, except ones that contain
• Local or static variables that are not accessible from the current execution point

Chapter 7, Using the integrated debugger 103


• Function calls
• Symbols or macros defined with #define
When you evaluate an expression, the current value of the expression is displayed in the
Result field of the dialog box. If you need to, you can format the result by adding a
comma and one or more format specifiers to the end of the expression entered in the
Expression text box. Table 7.1 details the legal format specifiers.
Table 7.1 Expression format specifiers
Character Types affected Function
H or X Integers Hexadecimal. Shows integer values in hexadecimal with the 0x
prefix, including those in data structures.
C Char, strings Character. Shows special display characters for ASCII 0–31. By
default, such characters are shown using the appropriate C
escape sequences (/n, /t, and so on).
D Integers Decimal. Shows integer values in decimal form, including those
in data structures.
Fn Floating point Floating point. Shows n significant digits (where n is in the range
of 2–18, and 7 is the default).
nM All Memory dump. Shows n bytes starting at the address of the
indicated expression. If n is not specified, it defaults to the size in
bytes of the type of the variable.
By default, each byte shows as two hex digits. The C, D, H, S, and
X specifiers can be used with M to change the byte formatting.
P Pointers Pointer. Shows pointers as seg:ofs instead of the default
Ptr(seg:ofs). It tells you the region of memory in which the
segment is located, and the name of the variable at the offset
address, if appropriate.
R Structures, unions Structure/Union. Shows both field names and values such as
(X:1;Y:10;Z:5) instead of (1,10,5).
S Char, strings String. Shows ASCII 0–31 as C escape sequences. Use only to
modify memory dumps (see nM above).

For example, to display a result in hexadecimal, type ,H after the expression. To see a
floating-point number to 3 decimal places, type ,F3 after the expression.
You can also use a repeat count to reference a specific number of data items in arrays and
structures. To specify a repeat count, follow the expression with a comma and the
number of data items you want to reference. For example, suppose you declared the
following array in your program:
int my_array[10];
The following expression evaluates the first 5 elements of this array and displays the
result in hexadecimal:
my_array,5h

Modifying the values of variables


Once you’ve evaluated a variable or data structure item, you can modify its value.
Modifying the value of data items during a debugging session lets you test different bug
hypotheses and see how a section of code behaves under different circumstances.

104 User’s Guide


To modify the value of a data item,
1 Open the Expression Evaluator dialog box and enter the name of the variable you
want to modify into the Expression input box.
2 Click Evaluate to evaluate the data item.
3 Type a value into the New Value text box (or choose a value from the drop down list),
then click Modify to update the data item.
Note When you modify the value of a data item through the debugger, the modification is
effective for that specific program run only; the changes you make through the
Expression Evaluator dialog box do not affect your program source code or the
compiled program. To make your change permanent, you must modify your program
source code in the Edit window, then recompile your program.
Keep these points in mind when you modify program data values:
• You can change individual variables or elements of arrays and data structures, but
you cannot change the entire contents of an array or data structure.
• The expression in the New Value text box must evaluate to a result that is
assignment-compatible with the variable you want to assign it to. A good guideline is
that if the assignment would cause a compile-time or run-time error, it’s not a legal
modification value.
Warning! Modifying values (especially pointer values and array indexes), can have undesirable
effects because you can overwrite other variables and data structures. Use caution
whenever you modify program values from the debugger.

Inspecting data elements


Inspect windows also let you examine and modify data values. Inspect windows are
extremely useful because they format the data according to the type of data being
viewed; there are different types of Inspect windows for scalars, arrays, structures,
functions, and classes with and without member functions.
The easiest way to inspect a data item is to highlight the expression you want to inspect
(or just position the text cursor on the token) in the Edit window, and choose Inspect
Object from the SpeedMenu (or press Alt+F5). If you inspect expressions using this
method, the expression is always evaluated within the scope of the line on which the
expression appears.
You can also inspect data expressions using the following method,
1 Choose Debug|Inspect to display the Inspect Expression window.
2 Type in the expression you want to inspect, or choose a previously entered
expression from the drop down list.
3 Choose OK to display an Inspector window.
If the execution point is in the scope of the expression you’re inspecting, the value
appears in the Inspect window. If the execution point is outside the scope of the

Chapter 7, Using the integrated debugger 105


expression, the value is undefined. Figure 7.6 shows two Inspect windows; the one on
the left displays a structure Inspect window, the one on the right shows an array.
Figure 7.6 Inspect windows

If you’re inspecting a compound data item, such as an array or a structure, you can view
the details of the data item by opening another Inspect window on the element you
want to inspect. To inspect an element of a compound data item,
1 In the Inspect window, select the item you want to inspect.
2 Choose Inspect on the Inspect window SpeedMenu, or press Enter.
You can also use Inspector windows to change the value of a single data item:
1 Select the data item whose value you want to modify.
2 Choose Change on the Inspect window SpeedMenu.
3 Type the new value into the Change Value dialog box and click OK.
If you’re inspecting a data structure, it’s possible the number of items displayed might
be so great that you’ll have to scroll in the Inspector window to see data you’re
interested in. For easier viewing, you can narrow the display to a range of data items:
1 Left-click in the Inspect window and choose Set Range from the SpeedMenu.
2 In the Starting Index text box, enter the index of the first item you want to view.
3 In the Count text box, enter the number of items you want to see in the Inspect
window.

Examining register values


While debugging, you can display the values of the CPU registers, and the settings of
the status flags. To view the Register window, choose View|Register.
Table 7.2 CPU flags in the Register window
Letter in pane Flag name
c Carry
z Zero
s Sign
o Overflow
p Parity
a Auxiliary carry
i Interrupt enable
d Direction

106 User’s Guide


The Register window SpeedMenu lets you select the format in which to display the
values in the registers; choose from Hexadecimal or Decimal. You can also choose to
view the 16-bit (word) or 32-bit (double word) registers.

Viewing function calls


While debugging, it can be useful to know the order of function calls that brought you to
your current program location. Using the Call Stack window, you can view the current
sequence of function calls. The Call Stack window is also helpful when you want to
view the arguments passed to a function call; each function listing in the window is
followed by a listing that details the arguments with which the call was made. Use
View|Call Stack to display the Call Stack window.
Figure 7.7 Call Stack window

In the Call Stack window, the function that’s currently executing is listed on top, with all
previously called functions listed in sequence below. The bottom of the list always
shows the first function in the calling sequence. However, only functions in the
currently loaded module are listed in this window. To view functions located in a
different module, change symbol tables, as described in “Debugging dynamic-link
libraries” on page 109.
The Call Stack window is particularly useful if you accidentally trace into code you
wanted to step over. Using the Call Stack window, you can return to the point where the
current function was called from, and then resume debugging from there:
1 In the Call Stack window, double-click the function that called the function you
accidently traced into (it will be the second function listed in the Call Stack window).
The Edit window becomes active with the cursor positioned at the location of the
function call.
2 In the Edit window, move the cursor to the statement following the function call.
3 Choose Run to Cursor on the Edit window SpeedMenu (or press F4).

Navigating to function calls


Using the Call Stack window, you can view or edit the source code located at a
particular function call. Right-clicking a function in the Call Stack window displays the
SpeedMenu, from where you can choose either View Source or Edit Source. Each of
these commands cause the Edit window to display the selected function; however, Edit
Source gives focus to the Edit window so you can modify the source code at that
function location. If you select the top function in the Call Stack window, these

Chapter 7, Using the integrated debugger 107


commands cause the Edit window to display the location of the execution point in the
current function. Selecting any other function call causes the debugger to display the
actual function call in the Edit window.

Locating functions
You can locate a particular function quickly with the Locate Function command on the
Search menu. Choosing Search|Locate Function opens a dialog box that prompts you
for the name of a function. Enter a function name and choose OK to navigate to the
function definition in the Edit window. You must be debugging (stepping or tracing
through code) before you can use this command.

Catching general protection faults


If a general protection exception (GP exception) occurs while you’re running a program
in the IDE, your program halts and the General Protection Exception dialog box
appears. If you choose OK to close the dialog box, the debugger displays the code that’s
responsible for the GP exception in the Edit window, and the execution point marks the
exception.
At this point, you must choose Debug|Terminate Program to prevent your program
from crashing. Then you can correct the error that caused the problem before you run
your program again.

Sending messages to the Event Log window


In addition to using the Event Log window to log breakpoint expressions (as described
on page 100), you can also log window messages and output messages to the Event Log
window. To select the events you want to log,
1 Open the Event Log window by choosing View|Event Log.
2 Choose Set Options on the Event Log window SpeedMenu.
3 Select the Debugger topic, then select the Event Capture options you want:
• Window Messages
• Output Messages (on by default)
• Breakpoints (on by default)
The Event Log window has the following SpeedMenu commands:
Clear Events clears the Event Log window.
Save Events To File displays a dialog box so you can specify a file name. All events that
are currently in the Event Log window are saved in that file.
Add Comment prompts you for a line of text that is inserted in the Event Log window
as a comment.
Set Options opens the Environment Options dialog box, so you can select Debugger
options and set the Event Capture options you want.

108 User’s Guide


Debugging dynamic-link libraries
When you trace into a DLL used by your application, the debugger automatically loads
the symbol table for the DLL. (The DLL must have been compiled with Borland
symbolic debug information for you to be able to trace into it.) Because the debugger can
load only one symbol table into memory at a time, the debugger unloads the symbol
table for the .EXE file when it loads the DLL symbol table. Because of this, you won’t be
able to monitor the values of data items in your .EXE file while you’re tracing through
the DLL code.
For example, if your executable file MYAPP.EXE uses a function in the file
MYDLL.DLL, you can trace into the DLL (if it has debug information) when the DLL
function is called. When you step into MYDLL.DLL, its symbol table is loaded by the
debugger, and the MYAPP.EXE symbol table is unloaded.
To see which symbol table the debugger is using, choose Debug|Load Symbol Table.
The Load Symbol Table dialog box opens, displaying the currently loaded symbol table
at the top of the dialog box. Below this is a listing of the other symbol tables available to
the debugger.
You can switch between symbol tables to inspect data items that are defined in another
module. For example, if you’re stepping in MYDLL.DLL and want to examine the value
of a variable that’s defined in MYAPP.EXE, you can do so by loading the MYAPP.EXE
symbol table:
1 Choose Debug|Load Symbol Table.
2 Choose the symbol table you want to load from the Available Tables list.
3 Examine the data items in MYAPP.EXE.
When you’ve finished examining the variables in MYAPP.EXE, you must reload the
symbol table for MYDLL.DLL before you can continue stepping in that module.

Debugging in soft and hard mode


The Windows operating system is continually processing and generating window
messages. In addition, any program that runs under Windows (such as Turbo C++ for
Windows) must send and process window messages. Even actions such as resizing a
window, opening a dialog box, or moving the mouse cursor causes your program to
generate and process window messages.
Although the generation and handling of window messages is not normally a problem,
the debugger must take special care of the messages sent to and generated by the
program you’re debugging. The integrated debugger handles the messages sent and
received by your program, which frees you to debug your program and use the full
functionality of the Windows environment. When the debugger works simultaneously
with other Windows programs, the debugger is said to be working in soft mode.
However, during a debugging session, you might need to stop all other Windows
programs from executing. When all other Windows programs are halted, the debugger
is said to be working in hard mode. When the debugger is in hard mode, you won’t be
able to use the functionality of the Windows environment. For example, you won’t be

Chapter 7, Using the integrated debugger 109


able to switch to another task or do anything outside the functionality of the debugger
and the program you’re debugging—the debugger behaves as if it’s the only program in
memory. This is similar to running a program under the DOS environment.
The integrated debugger offers two different debugging modes: smart mode and hard
mode. Normally, you’ll use smart mode (checked by default) while debugging
programs. When Smart is selected, the debugger chooses hard or soft mode, depending
on what is happening in the Windows environment. However, you’ll want to specify
hard mode if your program sends intertask messages (such as DDE messages) or if
you’re debugging at a very low level. To change debugging modes,
1 Choose Options|Environment to open the Environment Options dialog box and
select the Debugger topic.
2 Select either Hard Mode On All Stops or Smart, depending on your needs.

110 User’s Guide


Chapter

WinSight and WinSpector


Chapter 8
8
This chapter describes the two utilities WinSight and WinSpector. WinSight is a tool that
lets you monitor the windows and window messages of the programs currently
running under Windows. WinSpector is a tool that helps you perform postmortem
debugging (debugging after your program has ungracefully terminated) of
Unrecoverable Application Errors and General Protection Faults.
These utilities can be launched from the Turbo C++ program group using the following
two icons:

WinSight
WinSight is a debugging tool that gives you information about windows, window
classes, and window messages. You can use it to study a Windows application, to see
how windows and window classes are created and used, and to see what messages the
windows receive.
You can configure WinSight to trace and display messages by
• Window
• Message type
• Window class
• A combination of these
WinSight is a passive observer: it intercepts and displays information about messages,
but it doesn’t prevent messages from getting to applications.
To start WinSight, double-click the WinSight icon. The WinSight window appears in its
default configuration; it displays the Window Tree view that lists all the windows

Chapter 8, WinSight and WinSpector 111


currently active on the desktop. WinSight saves your configuration, so if you open all
three views and exit WinSight, the next time you start it, all three views will display.
WinSight has three views: Class List, Window Tree, and Message Trace. You can
display these views from left to right or top to bottom by choosing View|Split
Horizontal or View|Split Vertical.
You can control the messages traced by WinSight (see page 115) and you can control
when messages start and stop tracing as described in the following sections.

Starting and stopping screen updates


To turn on tracing, choose Start! from the menu (Start! then becomes Stop! on the menu).
Normally, all three views are kept current as classes are registered, windows are created
and destroyed, and messages are received. However, you can use Messages|Trace Off
to suspend tracing of messages only (Class List and Window Tree will continue to
update).
Use Stop! and Start! to
• Study a particular situation.
• Control (minimize) the machine time WinSight uses when it updates itself constantly.

Turning off message tracing


To turn off tracing of message types, choose Messages|Trace Off. The Message Trace
view remains visible, and tracing resumes when you choose Messages|Selected
Classes, Selected Windows, or All Windows (provided tracing is on).
The following sections describe how to use the three views to get the information you
need to debug an application. Choose Spy|Exit to leave WinSight.

Choosing a view
WinSight has three views that can appear within its main window: Class List, Window
Tree, and Message Trace. You can choose to look at any or all of the views. WinSight
automatically tiles the views within the main window.
You can hide or display views at any time, using the View menu. Information and
selections are not lost when a view is hidden.
• The Class List view shows all the currently registered window classes.
• The Window Tree view displays the hierarchy of all the windows on the desktop.
Window Tree displays by default when you start WinSight.
• The Message Trace view displays information about messages received by selected
windows or window classes.
To get more detail about an item in Window Tree or Class List,
• Select a window or a class, then choose Spy|Open Detail.
• Double-click the window or class.

112 User’s Guide


The Detail window displays the class name, executable module, and other information
about the class or window.

Class List view


A class is the name with which the window class was registered with Windows.
Sometimes, instead of choosing specific windows to trace, you might want to look at
messages for entire classes of windows. WinSight lets you do this with the Class List
view.

Using the Class List view


The Class List view shows all the currently registered window classes. To get details
about a class, double-click it or select it and press Enter.
The diamonds next to the classes turn black momentarily whenever the window
receives any messages. This gives you an overview of which windows are currently
receiving messages. If a hidden child window receives a message, the diamond for the
parent changes color. Use the following format:
Class (Module) Function Styles
Class is the name of the class. Some predefined Windows classes have numeric names.
For example, the Popup menu class uses the number 32768 as its name. These
predefined classes are shown with both the number and a name, such as
#32768:PopupMenu. The actual class name is only the number (using the
MAKEINTRESOURCE format, which is also used for resource IDs).
Module is the name of the executable module (.EXE or .DLL) that registered the class.
Function is the address of the class window function.
Styles is a list of the cs_ styles for the class. The names are the same as the cs_ definitions
in WinTypes, except the cs_ is removed and the name is in mixed case (uppercase and
lowercase).

Spying on classes
To trace messages for one or more classes, select the classes in Class List (Shift+Click or
Ctrl+Click), then choose Messages|Selected Classes. If the Message Trace view is hidden,
it becomes visible when you choose Messages|Selected Classes.
Note that tracing messages to a class lets you see all messages to windows of that class,
including creation messages, which would otherwise not be accessible.
To change which classes are traced, change the selection in the Class List. Choose
Messages|Trace Off to turn off all message tracing to the Message view.

Chapter 8, WinSight and WinSpector 113


Window Tree view
The Window Tree view displays a hierarchical outline of all existing windows on the
desktop. This display lets you
• Determine what windows are present on the desktop.
• View the status of windows, including hidden windows.
• See which windows are receiving messages.
• Select windows for message tracing.
The lines on the left of the Window Tree view show the tree structure. Each window is
connected to its parent, siblings, and children with these lines. When a window receives
a message, the diamond next to it (or its parent window if the tree is collapsed) turns
black.
The diamond next to each window shows whether the window has any children. If the
diamond is blank, the window has no children. If the diamond contains a +, the window
has children that are not displayed. To show the next level of children, click the
diamond next to the window. To show all the levels of child windows (children of
children, and so on), right-click the diamond. If the diamond contains a –, the children
are displayed. To hide all of a window’s child windows, click the diamond next to the
window.
The format of the window details is as follows:
Handle {Class} Module (Position) "Title"
Handle is the window handle as returned by CreateWindow.
Class is the window class name, as described in the Class List view.
Module is the name of the executable module (.EXE or .DLL) that created the window.
Module is the name of the module owning the data segment passed as the hInstance
parameter to CreateWindow.
Position is “hidden” if the window is hidden. If the window is visible, Position is
indicated by using screen coordinates (for parent windows) or coordinates in the
parent’s client area (for child windows). Position uses the following format:
xBegin,yBegin - xEnd,yEnd
Title is the window title or text, as returned by GetWindowText or a wm_GETTEXT
message. If the title is the null string, the quotation marks are omitted.

Finding a window
WinSight has a special mode for locating windows. It can work in two ways: either
identifying the line in the Window Tree that corresponds to a window you point at with
the mouse, or highlighting a window you select in the Window Tree.
Important All other applications are suspended while you’re in Find Window mode. Enter Find
Window mode by choosing Spy|Find Window. In this mode, whenever the mouse
passes into the boundaries of a window, a thick border appears around that window,
and the window is selected in the Window Tree view.

114 User’s Guide


Alternatively, once in Find Window mode, you can select windows in the Window Tree
with the mouse or cursor keys, and WinSight will put a thick border around the selected
window or windows. If you press Enter, you will see the Window Detail window for the
selected window.

Leaving Find Window mode


Once you have located the window you want, you can leave Find Window mode by
clicking the mouse button or by pressing the Esc key. This removes the border from the
screen, leaving the current window’s description selected in the Window Tree view.

Spying on windows
To spy on one or more windows, select the windows (using the mouse and the Shift or
Ctrl key), then choose Messages|Selected Windows. To change which windows are
traced, change the selected window in Window Tree.
To spy on all windows, regardless of what is selected in the Class List or the Window
Tree, choose Messages|All Windows.
Message Trace becomes visible when you choose Messages|Selected Windows or
Windows|All Windows.
Choose Messages|Trace Off to disable message tracing without hiding Message Trace.

Choosing messages to trace


Message Trace displays messages received by selected window classes or windows.
Messages received via SendMessage are shown twice, once when they are sent and again
when they return to show the return value. Dispatched messages are shown once only,
since their return value is meaningless. The message display is indented to show how
messages are nested within other messages.

Using the Message Trace view


By default, WinSight traces all messages and displays them in the Message Trace view.
WinSight gives you several ways to narrow down the tracing of messages:
• Choose Messages|Selected Classes or Messages|Selected Windows, then select the
classes (in the Class List view) or windows (in the Window Tree view) by using the
mouse and Shift or Ctrl.
• Choose Message|All Windows.
• Choose Message|Options, then select any or all of fourteen groups of messages.
Check All Messages in the Options dialog box to return to tracing all messages.

Chapter 8, WinSight and WinSpector 115


Other tracing options
The Message Trace Options dialog box lets you change the format of the messages in
Message Trace. It also lets you trace messages to a file, printer, or an auxiliary monitor or
window.
• Normally, the Message Trace view interprets each message’s parameters and
displays them in a readable format (Interpret Values is checked). Check Hex Values
to view message parameters as hex values of wParam and lParam.
• Information on traced messages usually displays in the Message Trace view.
However, you can send messages to a file, printer, or auxiliary monitor by checking
Log File in the Message Trace Options dialog box and doing one of the following:
• Type a file name to trace to a log file. If the file already exists, messages are
appended to the file.
• Type the name of the device (for example, type PRN) for the log file to send output
to the printer port.
• Type AUX to output trace messages to an auxiliary monitor or window. To do
this, you must have WINOX.SYS or OX.SYS installed as a device in your
CONFIG.SYS file. To stop logging message traces to a file, printer, or auxiliary
monitor, uncheck Log File. Use the following format:
Handle ["Title" or {Class}] Message Status
Handle is the window handle receiving the message.
Title is the window’s title. If the title is the null string, the class name is displayed
instead, in curly braces.
Message is the message name as defined by Windows. They are displayed in WinSight in
all uppercase letters. Known undocumented Windows messages are shown in
lowercase. Unknown message numbers (user-defined) are shown as wm_User+0xXXXX
if they are greater-than or equal to wm_User or as wm_0xXXXX if they are less than
wm_User. Registered message numbers (from RegisterWindowsMessage) are shown with
their registered name in single quotes.
Status is one or more of the following:
• Dispatched indicates the message was received via DispatchMessage.
• Sent [from XXXX] indicates the message was received via SendMessage. If it was sent
from another window, from XXXX gives that window’s handle. If it was sent from the
same window receiving it, this is shown with from self. If it was sent from Windows
itself, the “from” phrase is omitted.
• Returns indicates the message was received via SendMessage and is now returning.
• Additional messages might include a numeric return value or text message such as
wm_GetText. For sent and dispatched messages, WinSight interprets the parameters
and gives a readable display. For messages that have associated data structures
(wm_Create, for example) it takes those structures and includes them in the display.

116 User’s Guide


Table 8.1 Mouse messages
WM_HSCROLL WM_MBUTTONUP WM_RBUTTONDOWN
WM_LBUTTONDBLCLK WM_MOUSEACTIVATE WM_RBUTTONUP
WM_LBUTTONDOWN WM_MOUSEFIRST WM_SETCURSOR
WM_LBUTTONUP WM_MOUSELAST WM_VSCROLL
WM_MBUTTONDBLCLK WM_MOUSEMOVE
WM_MBUTTONDOWN WM_RBUTTONDBLCLK

Table 8.2 Window messages


WM_ACTIVATE WM_GETDLGCODE WM_QUERYNEWPALETTE
WM_ACTIVATEAPP WM_GETFONT WM_QUERYOPEN
WM_CANCELMODE WM_GETMINMAXINFO WM_QUIT
WM_CHILDACTIVATE WM_GETTEXT WM_SETFOCUS
WM_CLOSE WM_GETTEXTLENGTH WM_SETFONT
WM_CREATE WM_ICONERASEBKGND WM_SETREDRAW
WM_CTLCOLOR WM_KILLFOCUS WM_SETTEXT
WM_DDE_FIRST WM_MOVE WM_SHOWWINDOW
WM_DESTROY WM_PAINT WM_SIZE
WM_ENABLE wm_painticon WM_WINDOWPOSCHANGED
WM_ENDSESSION WM_QUERYDRAGICON WM_WINDOWPOSCHANGING
WM_ERASEBKGND WM_QUERYENDSESSION

Table 8.3 Input messages


WM_CHAR WM_KEYUP WM_SYSKEYDOWN
WM_CHARTOITEM WM_MENUCHAR WM_SYSKEYUP
WM_COMMAND WM_MENUSELECT WM_TIMER
WM_DEADCHAR WM_PARENTNOTIFY WM_VKEYTOITEM
WM_KEYDOWN WM_SYSCHAR wm_yomichar
WM_KEYLAST WM_SYSDEADCHAR

Table 8.4 System messages


WM_COMPACTING WM_PALETTECHANGED WM_SYSCOLORCHANGE
WM_DEVMODECHANGE WM_PALETTEISCHANGING WM_SYSCOMMAND
WM_ENTERIDLE WM_POWER WM_TIMECHANGE
WM_FONTCHANGE WM_QUEUESYNCH WM_WININICHANGE
wm_null WM_SPOOLERSTATUS

Chapter 8, WinSight and WinSpector 117


Table 8.5 Pen messages
WIN_USER WM_HOOKRCRESULT WM_RCRESULT
WM_GLOBALRCCHANGE WM_PENWINFIRST WM_SKB
WM_HEDITCTL WM_PENWINLAST

Table 8.6 Initialization messages


WM_INITDIALOG WM_INITMENU WM_INITMENUPOPUP

Table 8.7 Clipboard messages


WM_ASKCBFORMATNAME WM_DESTROYCLIPBOARD WM_RENDERALLFORMATS
WM_CHANGECBCHAIN WM_DRAWCLIPBOARD WM_RENDERFORMAT
WM_CLEAR WM_HSCROLLCLIPBOARD WM_SIZECLIPBOARD
WM_COPY WM_PAINTCLIPBOARD WM_UNDO
WM_CUT WM_PASTE WM_VSCROLLCLIPBOARD

Table 8.8 DDE messages


WM_DDE_ACK WM_DDE_EXECUTE WM_DDE_REQUEST
WM_DDE_ADVISE WM_DDE_INITIATE WM_DDE_TERMINATE
WM_DDE_DATA WM_DDE_POKE WM_DDE_UNADVISE

Table 8.9 Nonclient messages


WM_NCACTIVATE WM_NCLBUTTONDOWN WM_NCPAINT
WM_NCCALCSIZE WM_NCLBUTTONUP WM_NCRBUTTONDBLCLK
WM_NCCREATE WM_NCMBUTTONDBLCLK WM_NCRBUTTONDOWN
WM_NCDESTROY WM_NCMBUTTONDOWN WM_NCRBUTTONUP
WM_NCHITTEST WM_NCMBUTTONUP
WM_NCLBUTTONDBLCLK WM_NCMOUSEMOVE

Table 8.10 Control messages


BM_GETCHECK CBN_SELCHANGE EN_VSCROLL
BM_GETSTATE CBN_SELENDCANCEL LB_ADDSTRING
BM_SETCHECK CBN_SETFOCUS LB_DELETESTRING
BM_SETSTATE DM_GETDEFID LB_DIR
BM_SETSTYLE DM_SETDEFID LB_FINDSTRING

118 User’s Guide


Table 8.10 Control messages (continued)
BN_CLICKED EM_CANUNDO LB_FINDSTRINGEXACT
BN_DISABLE EM_EMPTYUNDOBUFFER LB_GETCARETINDEX
BN_DOUBLECLICKED EM_FMTLINES LB_GETCOUNT
BN_HILITE EM_GETFIRSTVISIBLELINE LB_GETCURSEL
BN_PAINT EM_GETHANDLE LB_GETHORIZONTALEXTENT
BN_UNHILITE EM_GETLINE LB_GETITEMDATA
CB_ADDSTRING EM_GETLINECOUNT LB_GETITEMHEIGHT
CB_DELETESTRING EM_GETMODIFY LB_GETITEMRECT
CB_DIR EM_GETPASSWORDCHAR LB_GETSEL
CB_FINDSTRING EM_GETRECT LB_GETSELCOUNT
CB_FINDSTRINGEXACT EM_GETSEL LB_GETSELITEMS
CB_GETCOUNT em_getthumb LB_GETTEXT
CB_GETCURSEL EM_GETWORDBREAKPROC LB_GETTEXTLEN
CB_GETDROPPEDCONTROLRECT EM_LIMITTEXT LB_GETTOPINDEX
CB_GETDROPPEDSTATE EM_LINEFROMCHAR LB_INSERTSTRING
CB_GETEDITSEL EM_LINEINDEX LB_MSGMAX
CB_GETEXTENDEDUI EM_LINELENGTH LB_RESETCONTENT
CB_GETITEMDATA EM_LINESCROLL LB_SELECTSTRING
CB_GETITEMHEIGHT EM_MSGMAX LB_SELITEMRANGE
CB_GETLBTEXT EM_REPLACESEL LB_SETCARETINDEX
CB_GETLBTEXTLEN em_scroll LB_SETCOLUMNWIDTH
CB_INSERTSTRING EM_SETFONT LB_SETCURSEL
CB_LIMITTEXT EM_SETHANDLE LB_SETHORIZONTALEXTENT
CB_MSGMAX EM_SETMODIFY LB_SETITEMDATA
CB_RESETCONTENT EM_SETPASSWORDCHAR LB_SETITEMHEIGHT
CB_SELECTSTRING EM_SETRECT LB_SETSEL
CB_SETCURSEL EM_SETRECTNP LB_SETTABSTOPS
CB_SETEDITSEL EM_SETSEL LB_SETTOPINDEX
CB_SETITEMDATA EM_SETTABSTOPS LBN_DBLCLK
CB_SETITEMHEIGHT EM_SETWORDBREAK LBN_ERRSPACE
CB_SHOWDROPDOWN EM_UNDO LBN_KILLFOCUS
CBN_CLOSEUP EN_CHANGE LBN_SELCANCEL
CBN_DBLCLK EN_ERRSPACE LBN_SELCHANGE
CBN_DROPDOWN EN_HSCROLL LBN_SETFOCUS
CBN_EDITCHANGE EN_KILLFOCUS STM_GETICON
CBN_EDITUPDATE EN_MAXTEXT STM_SETICON
CBN_ERRSPACE EN_SETFOCUS
CBN_KILLFOCUS EN_UPDATE

Chapter 8, WinSight and WinSpector 119


Table 8.11 Multimedia messages
MM_ADLIB MM_MIM_CLOSE MM_SNDBLST_MIDIIN
MM_JOY1BUTTONDOWN MM_MIM_DATA MM_SNDBLST_MIDIOUT
MM_JOY1BUTTONUP MM_MIM_ERROR MM_SNDBLST_SYNTH
MM_JOY1MOVE MM_MIM_LONGDATA MM_SNDBLST_WAVEIN
MM_JOY1ZMOVE MM_MIM_LONGERROR MM_SNDBLST_WAVEOUT
MM_JOY2BUTTONDOWN MM_MIM_OPEN MM_WAVE_MAPPER
MM_JOY2BUTTONUP MM_MOM_CLOSE MM_WIM_CLOSE
MM_JOY2MOVE MM_MOM_DONE MM_WIM_DATA
MM_JOY2ZMOVE MM_MOM_OPEN MM_WIM_OPEN
MM_MCINOTIFY MM_MPU401_MIDIIN MM_WOM_CLOSE
MM_MICROSOFT MM_MPU401_MIDIOUT MM_WOM_DONE
MM_MIDI_MAPPER MM_PC_JOYSTICK MM_WOM_OPEN

Table 8.12 Other messages and messages not documented by Microsoft


wm_alttabactive wm_entersizemove WM_MDIRESTORE
wm_begindrag wm_exitmenuloop WM_MDISETMENU
WM_COALESCE_FIRST wm_exitsizemove WM_MDITILE
WM_COALESCE_LAST wm_filesyschange WM_MEASUREITEM
WM_COMMNOTIFY wm_gethotkey WM_NEXTDLGCTL
WM_COMPAREITEM wm_isactiveicon wm_nextmenu
wm_convertrequest WM_KEYFIRST wm_querydropobject
wm_convertresult wm_lbtrackpoint wm_queryparkicon
WM_DELETEITEM WM_MDIACTIVATE wm_sethotkey
wm_dragloop WM_MDICASCADE wm_setvisible
wm_dragmove WM_MDICREATE wm_sizewait
wm_dragselect WM_MDIDESTROY wm_syncpaint
WM_DRAWITEM WM_MDIGETACTIVE wm_synctask
WM_DROPFILES WM_MDIICONARRANGE WM_SYSTEMERROR
wm_dropobject WM_MDIMAXIMIZE wm_systimer
wm_entermenuloop WM_MDINEXT wm_testing

WinSpector
WinSpector and its utilities help you perform a postmortem examination of
Unrecoverable Application Errors (UAEs) and General Protection Faults (GPFs). When
a UAE or GPF occurs, WinSpector writes a log file to your disk that shows you helpful
information about the cause of the exception, including
• The call stack that was active when an exception occurred
• Function and procedure names in the call stack

120 User’s Guide


• CPU registers
• A disassembly of the machine instructions where the exception occurred
• Windows information about the program environment
Before using WinSpector, be sure that TOOLHELP.DLL (from Windows 3.1 or later) is
in your search path (TOOLHELP.DLL ships with Windows). TOOLHELP.DLL is a
Windows DLL that lets utilities access low-level system information. WinSpector uses
TOOLHELP.DLL to log exceptions and to obtain the system information it writes to the
log file. Don’t use other exception debugging tools, except for Turbo Debugger, while
running with WinSpector.
There are three ways to start WinSpector (it loads minimized):
• Include it in the “load=” section of your WIN.INI file.
• Include it in the Startup folder in Windows.
• Double-click the WinSpector icon to run WinSpector after you load Windows.
When an exception (UAE or GPF) occurs, WinSpector creates a report in a file called
WINSPCTR.LOG (a text file) with information to help you determine what caused the
error. WinSpector also creates a file called WINSPCTR.BIN, a binary file that the DFA
utility translates into a text file called DFA.OUT (see page 126 for more information on
DFA.EXE).
After the exception, WinSpector displays a dialog box with a brief exception report.
Click OK to remove the box and read the log file to find the cause of the exception. You
can control the output to WINSPCTR.LOG as described in the following section.

Configuring WINSPCTR.LOG
There are two ways you can set the WinSpector options that control the output to
WINSPCTR.LOG:
• To use the WinSpector Preferences dialog box, start WinSpector, click the WinSpector
icon and choose Preferences from the pop-up menu.
• To edit commands in WINSPCTR.INI, load the file into any text editor, edit or add
commands, then save the file and restart WinSpector.
The following sections describe each option in the Preferences dialog box.
WINSPCTR.INI options are listed in bold.
LogDir=[directory]: Directory is the location of WINSPCTR.LOG. Type the path where
you want the file (C:WINDOWS is the default).
LogViewer=[viewername]: Viewer is the program WinSpector uses to display the log
file. Type the path and file name of the viewer you want to use (NOTEPAD.EXE is the
default). For example, C:WIN31WRITE.EXE. If WinSpector can’t find the editor, it
displays the message Error: Unable to execute: [option], where option is the editor file
name. Check to make sure the editor you indicated exists in the specified directory.
CreateNewLog= 0 (append) or 1 (overwrite): Append New Reports and Overwrite
Previous Reports lets you control whether WinSpector appends reports to the existing
log file or overwrites the old log file when a new report is generated.

Chapter 8, WinSight and WinSpector 121


ShowSystemInfo= 0 (omit) or 1 (show): Check System Information to add the Task
List, the Module List, and information about the USER and GDI heaps to the log file.
LogToStdAux=0 (on) or 1 (off): Check AUX Summary to view an abbreviated form of
the information sent to the log file on the AUX device. To use this option, you need a
terminal connected to AUX or a device driver, such as OX.SYS, that redirects the AUX
device to a second monitor.
PostMortemDump= 1 (show) or 0 (omit): Check PostMortem Dump to generate a
WINSPCTR.BIN file. Use DFA.EXE to translate the BIN file into a text file you can read.
ShowStackInfo= 1 (show) or 0 (omit): Check Stack Frame Data to add a verbose stack
trace display to the log file. For each stack frame that doesn’t exceed 256 bytes,
WinSpector performs a hex dump, starting at the SS:BP for that frame. If there are more
than 256 bytes between two successive stack frames, the memory display is omitted for
that frame. You can use this data to get the values of the parameters that were passed to
the function.
It’s usually easier to let DFA do the hard work of figuring out what your parameters are.
However, for those cases where Turbo Debugger information is not available, you
might find that a verbose trace supplies helpful information.
ShowUserInfo= 1 (show) or 0 (omit): Check User Comments if you want to add
information to the log file about what was happening when the exception occurred.
With User Comments checked, WinSpector displays a dialog box immediately after the
exception. The comments you type are appended to the log file.

WINSPCTR.LOG reference
Each report in WINSPCTR.LOG has several sections that help you determine what
caused the exception in your program. The first line of a report in WINSPCTR.LOG
gives the date and time when the exception occurred; for example,
WinSpector failure report - 6/18/1992 11:04:25
The second line lists
• What type of exception occurred ( lists frequent exceptions)
• The module name
• The logical address
• The physical address
• The currently active task at the time of the exception.
A second line might look like this:
Exception 13 at USER 002A:0429 (079F:0429) (TASK=BAD)

Table 8.13 Exception types


Number Name Description
0 Division by zero Occurs during a DIV or an IDIV interaction if the divisor is 0.

122 User’s Guide


Table 8.13 Exception types (continued)
Number Name Description
12 Stack fault Usually occurs when there is not enough room on the stack to proceed.
13 General protection All protection errors that don’t cause another exception cause an
fault (GPF) exception 13.

Exception 13 errors include, but are not limited to, the following errors:
• Invalid selector loaded into a segment register.
• Segment limit exceeded. Although the selector is valid, the offset value is greater than
the segment limit (for example, an array index out of bounds error in DS, ES, or other
segments).
• Execution is transferred to a nonexecutable segment, such as a bad function pointer.
• Accessing DS, ES, FS, or GS registers containing a null selector. (This error can cause a
0 to appear in the segment register of the log file.)
A log file lists both the physical and logical addresses where the exception occurred.
These two types of addresses are important to Windows programs for the following
reasons:
• When a program is loaded, Windows allocates space for each logical segment and
assigns each segment a unique selector. The selector and its offset are combined to
form a physical address.
• When a Windows .EXE file is linked, each segment is placed in a different section of
the file, and a segment table is created.
• A logical address, which is actually a segment’s position in the Windows segment
table, consists of a module name, a logical segment, and an offset. You can run
TDUMP on the file to find out segment size and other information, or you can
generate a .MAP file that contains the same kind of information.
If the stack pointer is too small at the time of exception, TOOLHELP.DLL automatically
switches the stack and appends the message Stack Switched to the end of the second line
of the log.

Disassembly section
The Disassembly section in WINSPCTR.LOG begins with the assembly language
instruction that caused the exception that is followed by the next few instructions in the
program, which provide a point of reference for finding the task that caused the
exception.
For example, given the following code, where ES is the segment register that contains a
selector and BX is the offset into the segment, an exception 13 occurred because the
value in BX was greater than the segment limit referenced by ES:
079F:0429 CMP BYTE PTR ES:[BX],FF
079F:042D JNE 043A
079F:042F CMP WORD PTR [BP+06],03
079F:0435 MOV DI, 0001

Chapter 8, WinSight and WinSpector 123


Stack Trace section
The first line of the Stack Trace section in WINSPCTR.LOG identifies the function or
procedure that was executing at the time of the exception. Stack Trace information
includes the
• Frame number.
• Module name.
• Name of the closest function before the address of the one that caused the exception,
plus a number indicating how far away you were from that function. (This
information is present only if a .SYM file is present.)
• Logical and physical address for the stack frame.
• Location where your program returns after the call.
When WinSpector lists function names, it looks in the .SYM file for the closest symbol
name that appears before the address in the call stack. Since some .SYM files do not
contain information for all functions, the function name in the log file is the closest
function in the .SYM file with an address preceding the frame address. If the offset field
appears to be too high, function names might not be reliable.
The following stack trace information shows some of the functions that were executing
at the time BAD, a sample task, caused an exception:
Stack Trace:
0 User <no info>
CS:IP 002A:0429 (079F:0429) SS:BP 10FF:18CA
C:WIN31SYSTEMUSER.EXE

3 BAD function5(unsigned long, unsigned long, unsigned long) + 0014


CS:IP 0001:0184 (1107:0184) SS:BP 10FF:1952
C:BINBAD.EXE

Register section
The Register section in WINSPCTR.LOG lists the values stored in the standard registers
when the exception occurred, as the following example shows:
Registers:
AX 0037
BX 0000
CX 0008
DX 10EE
SI 0037
DI 0028
Limits and access rights are given for the CS, DS, ES, and SS registers.

Message Queue section


The Message Queue section in WINSPCTR.LOG gives the last message received in the
middle of processing. This section also lists any messages that were waiting in the queue
at the time of exception. For each message, WinSpector lists the following information:

124 User’s Guide


• The Window handle that identifies the destination window
• The Message ID number that identifies the message
• Two parameters that contain additional message information
Note The Message Queue section might not list the last message the program received:
Windows could bypass the message queue by using a SendMessage or similar function.
The following Message Queue example shows one message received and one waiting in
the queue:
Message Queue:
Last message received:
hWnd: 0000 msg: 0001 wParam: 0002 lParam: 00000003
Waiting in queue:
hWnd: 0000 msg: 0001 wParam: 0002 lParam: 00000003

Tasks section
The Tasks section in WINSPCTR.LOG lists the programs running when the exception
occurred, including the
• Complete path to the executable file
• Module name
• Windows module handle
• Task handle
• Data segment value for the task (the instance handle)
Some of the tasks running when the BAD application caused an exception include
C:WIN31SYSTEMNWPOPUP.EXE
Module: NWPOPUP hModule: 142F hTask: 141F hInstance: 13F6

C:BINWINSPCTR.EXE
Module: WINSPCTR hModule: 1397 hTask: 1387 hInstance: 135E

C:BINBAD.EXE
Module: BAD hModule: 1467 hTask: 1127 hInstance: 10FE

Modules section
The Modules section in WINSPCTR.LOG lists the modules that were running at the
time of the exception, including the
• Path to the executable file
• Date stamp of the executable file
• File size
• Module name
• Module handle
• Reference count indicating how many times the module is in use
Three of the modules running when the BAD application caused an exception include
C:WIN31SYSTEMKRNL386.EXE Date: 03/02/1992 Size: 116132
Module: KERNEL hModule: 010F reference count: 21
C:WIN31SYSTEMSYSTEM.DRV Date: 03/01/1992 Size: 2304

Chapter 8, WinSight and WinSpector 125


Module: SYSTEM hModule: 013F reference count: 13

C:CBINWINSPCTR.EXE Date: 06/02/1992 Size: 46256


Module: WINSPCTR hModule: 1397 reference count: 1

USER and GDI heap section


The USER and GDI (graphics device interface) heap information section in
WINSPCTR.LOG shows what percentage of the USER and GDI heaps was available at
the time of exception. For example,
USER Free 91%
GDI Free 83%
Because Windows has only 64K of internal heap space for applications to share, it’s
often helpful to keep track of how the space is used. If you find that USER and GDI are
taking up a lot of heap space, check to see if you have deallocated resources you are not
using. The Help|About box for Program Manager lists the lower of these values as the
amount of free System Resources.

System Information section


The System Information section in WINSPCTR.LOG shows the windows version and
mode you’re running, including
• CPU type
• Largest free block of contiguous linear memory in the system
• Total linear address space in pages
• Amount of free memory pages in the linear address space
• Number of pages in the system swap file
The System Information section for a 486 system might look like this:
System info: Running in enhanced mode under Windows 3.1 debug version
CPU: 80486
Largest free memory block: 3457024 bytes
Total linear memory space: 19696 K
Free linear memory space : 18212 K
Swap file Pages: 0 (0 K)

Processing WinSpector data


DFA is a utility that takes a WINSPCTR.BIN file and Turbo Debugger information
(either in the .EXE, .DLL or .TDS files) and translates the binary data into a useful form
by generating a file that contains not only stack trace information similar to the log file
but also function names, line numbers, and local and global variables.
DFA post-processes Turbo Debugger information that WinSpector gathered at the time
of the exception. If you check the PostMortem dump option (see page 122), WinSpector
creates a WINSPCTR.BIN file at the time of the exception. You can use DFA.EXE to
translate the binary data in WINSPCTR.BIN into usable information stored in a text file
called DFA.OUT.

126 User’s Guide


Because only one WINSPCTR.BIN file is written per Windows session, make sure you
run DFA promptly. For example, if you get three UAEs in succession, WinSpector will
write three reports to the log file, but binary data will exist for only the first report. It’s
best to run DFA immediately after receiving the first UAE. You might then want to
rename the DFA.OUT file and delete the WINSPCTR.BIN and WINSPCTR.LOG files
before continuing.

DFA output
DFA writes a file only if Turbo Debugger information exists for the file in the stack
frame. The DFA output file (DFA.OUT) has a stack trace similar to the one in the
WinSpector log file, except that it contains
• Function names
• Line numbers
• Local and global variables
• Data segments and their values (including the stack segment)

Using DFA with WINSPCTR.LOG


When DFA is used with the WINSPCTR.LOG file alone, it gives minimal stack trace
information, such as addresses. If Turbo Debugger information (contained in a .EXE,
.DLL, or .TDS file) is present, source file names and line numbers are added to the
report.

Using DFA with WINSPCTR.BIN


When used with the WINSPCTR.BIN file, DFA
• Adds stack-based variables to the log, including local variables, parameters passed to
the function, structures and arrays.
• Lists variable types, values, and addresses by function.
If Turbo Debugger information is present, for each stack frame, DFA reports
• In section one, the
• Source file
• Line number
• Local variables
• Parameters
• In section two, the
• Module name for the task with the fault
• File names
• Logical segments
• The segments’ selectors
• Whether the segments are data or code segments

Chapter 8, WinSight and WinSpector 127


• In section three, the
• Global variables
• Static variables
• The variables’ values at the time of the exception
The format is
DFA [option] WINSPCTR.LOG [WINSPCTR.BIN]
When WINSPCTR.LOG (required) is present, you get source file and line numbers.
When WINSPCTR.BIN (optional) is present, you get additional variable information.
Table 8.14 DFA options
Option What it does
/O[outputfile] Renames the output file from the DFA.OUT default
/D Forces DFA to write a hex dump of the saved data segments

Other WinSpector tools


WinSpector has three utilities you can use to enhance the information about an
exception:
• EXEMAP.EXE creates a .MAP file from a Windows .EXE file. The .MAP file is needed
to create a .SYM file, which expands error reporting for the original .EXE.
• TMAPSYM.EXE, used in conjunction with EXEMAP.EXE, creates a .SYM file from a
.MAP file.
• BUILDSYM.EXE uses EXEMAP.EXE and TMAPSYM.EXE to create a .SYM file from
a Windows .EXE file.

Using EXEMAP.EXE
EXEMAP creates .MAP files for Windows executables. A .MAP file can be used to create
a .SYM file, which can then be used by WinSpector to expand its error reporting. If you
are using .DLLs or other programs for which you don’t have the source code, this
information can be especially useful.
To create a .MAP file from an .EXE, type EXEMAP filename.EXE newname.MAP. If you don’t
type a new name, EXEMAP creates a .MAP file with the same name as the .EXE.
Although the resulting .MAP file isn’t as complete as one generated by the link phase of
the compile process, it does include addresses for exported public functions.

Using TMAPSYM.EXE
TMAPSYM creates .SYM files from existing .MAP files (created either by the compiler or
by the EXEMAP utility). The resulting .SYM files make available to WinSpector the
public functions, variable names, and functions in the entry table of the executable.

128 User’s Guide


Constants and line-number information, however, are not included in a TMAPSYM-
generated .SYM file.
To create a .SYM file from a .MAP file, type TMAPSYM filename.MAP (you must type the
.MAP extension).

Using BUILDSYM.EXE
BUILDSYM creates .SYM files from .EXE files. It has the same output as using both
EXEMAP and TMAPSYM, since it automatically runs them, but it deletes the .MAP files
from your directory. BUILDSYM supports wildcards, so you can create .SYM files for
part or all of a directory by entering a single command.
To run BUILDSYM, both EXEMAP and TMAPSYM must be in the same directory as
BUILDSYM or in your search path. BUILDSYM places the .SYM files it creates in the
current directory. For WinSpector to find a .SYM file, the file must be in the same
directory as the executable that caused the exception.
BUILDSYM performs the following tasks:
• Verifies that the files are Windows files, and if not, leaves them alone.
• Calls EXEMAP to create .MAP files.
• Verifies that .MAP files were created.
• Calls TMAPSYM and passes the names of the new .MAP files so TMAPSYM can
create .SYM files.
• Deletes the .MAP files because they are no longer needed.
To create a .SYM file from an .EXE, type BUILDSYM filename.EXE.

Chapter 8, WinSight and WinSpector 129


130 User’s Guide
Part

II
Using Resource Workshop
Part II

Part II of this manual describes how to create, compile, and link resources to
applications running under Microsoft Windows versions 3.0 and later. You will learn to
• Work with resources in either text or binary format.
• Manage hundreds of resources stored in dozens of files.
• Use multilevel Undo and Redo to step back through changes you’ve made.
• Compile your resources only when you need to.
• Change a program’s resources even if you don’t have access to the source code.
• Automatically check for errors, such as incorrect syntax and duplicate resource IDs.
The following chapters constitute Part II:
• Chapter 9, “An overview of working with resources,” describes resources and
shows how to create and edit resources by working with resource script, binary, and
graphic files.
• Chapter 10, “Working with dialog boxes,” describes how to work with dialog boxes.
• Chapter 11, “Working with menus and accelerator tables,” describes how to work
with menus and accelerators.
• Chapter 12, “Working with string tables,” describes how to work with strings.
• Chapter 13, “Working with graphics,” describes how to work with graphics.
• Chapter 14, “Working with version information and custom data types,” describes
how to work with version information and custom data types.

Part II, Using Resource Workshop 131


132 User’s Guide
Chapter

An overview of working
Chapter 9
9
with resources
Resource Workshop provides the tools you need to create and edit the resources of an
application without using code. The tools include editors for dialog boxes, menus,
accelerators, graphics, and strings. Resource Workshop also has a built-in script (text)
editor, which you can use to create and edit non-graphical resources, such as version
information and custom data types.
In general, you use Resource Workshop to perform the following tasks:
• Create and edit resource script (.RC) files. A resource script file contains the ASCII
data from which you can generate one or more binary resources. Then you can link
the resources to an application, and refer to the resources in the application’s code.
• Edit resources in binary files. Resources are linked to an executable (.EXE), dynamic-
link library (.DLL), or other binary file. When you open a binary file in Resource
Workshop, the resources linked to the file are automatically decompiled so that you
can edit them. When you’re done making changes, you can recompile and relink the
resources to the original binary file.
• Create and edit graphic files. Resource Workshop’s Graphic editor is similar to the
Windows Paintbrush. However, with the Graphic editor, you’re not restricted to
bitmap (.BMP) files; you can create icon (.ICO), cursor (.CUR), and font (.FNT) files as
well.
This chapter describes resources and shows how to create and edit resources by
working with resource script, binary, and graphic files. This chapter also shows how to
customize Resource Workshop.

Chapter 9, An overview of working with resources 133


What is a resource?
A resource is a binary data item that is linked to an .EXE, .DLL, or other binary file.
Typically, a resource defines one of the following user interface components:
• A dialog box, which is a pop-up window that uses labels, text boxes, buttons, check
boxes, scroll bars, and other controls to give information to and receive information
from a user. You can create a dialog box that pops up when a menu command is
chosen or when an event occurs in an application. You can also create a dialog box
that serves as the main window for an application.
• A menu, which is a list of commands from which a user can choose. Types of menus
include standard menus, which appear on an application’s menu bar; floating menus,
which can appear anywhere on the screen; and hierarchical (cascading) menus,
which can appear when you choose a menu command. Applications often have
standard menus that are labeled File, Edit, and Help; these menus contain file
manipulation, editing, and online Help commands respectively.
• An accelerator table, which is one or more key combinations that a user can press to
perform an action. For example, many applications use Ctrl+X to cut data and Ctrl+V to
paste data.
• A string table, which is one or more text strings that can contain descriptions,
prompts, error messages, and so on.
• A bitmap, which is a graphic image, such as a picture, logo, or other drawing.
• An icon, which is a graphic image that represents a minimized window. An icon is
64x64, 32x32, 16x32, or 16x16 pixels in size.
• A cursor, which is a graphic image that shows the position of the mouse on the screen
and indicates the types of actions that a user can perform. A cursor is 32x32 pixels in
size. Many applications use a pointer, which indicates that the user can make a
selection, and an hourglass, which indicates that the system is performing an action.
• A font, which is a set of characters with a specific typeface and size. For example, 10-
point Times Roman bold is a font. A font resource can also contain a set of bitmaps
that aren’t characters. Although Windows supports both raster fonts, which contain
bitmaps for each character, and outline fonts, which contain drawing commands for
each character, you can only create raster fonts in Resource Workshop. For more
sophisticated font technology, you should consult with a third-party vendor.
A resource can also define
• Version information, which is a block of data that can be used in several Windows API
functions, including GetFileVersionInfo and VerInstallFile. Among other information,
the version information resource specifies the version number, file type, operating
system of an application.
• A custom data type, which is any data that you want to link to an application. For
example, you can create a custom data type for blocks of text that exceed the 255-
character limit of a string resource, or you can create a custom data type for metafiles,
which are files that contain mathematical representations of images.

134 User’s Guide


Why you should link resources to your applications
By linking resources to an application, you can keep data separate from code. This
separation allows you to easily
• Find and change parts of the application, such as user interface components. For
example, if you keep all the strings for the application in a string table, you can easily
customize the application for a foreign language: just open the resource script file
containing the string table, translate the strings, save the resource script file, and then
relink the corresponding resources to the application. You don’t need to search for
and change the strings in code.
• Change an application without changing its source files. With Resource Workshop,
you can extract, modify, and save resources directly into a binary file, such as an .EXE
or .DLL file. You don’t need the original resource script files.
• Share data among your applications. You can include the same resources in any
application. You don’t need to recreate resources from scratch.
• Create and edit resources in a graphical environment. With Resource Workshop, you
can work with resources just as they appear in the application. You don’t need to
compile and run the application to see user interface changes.

Starting Resource Workshop


You create and edit resources with Resource Workshop. To start Resource Workshop
from the IDE, double-click a resource script (.RC) file node or choose Tool|Resource
Workshop. To start Resource Workshop from Program Manager, double-click the
Resource Workshop icon.
After you’ve started Resource Workshop, you’re ready to create and edit resources by
working with resource script, binary, and graphic files.

To See
Create or edit a resource script file “Working with resource script files” on page 135
Edit resources in a binary file “Working with binary files” on page 142
Create or edit a graphic file “Working with graphic files” on page 143

Working with resource script files


To create and edit resources, you use resource script files. A resource script file contains
one or more sets of ASCII data, called resource scripts, from which binary resources can
be generated. Each resource type has a different resource script format; however, you
don’t need to know these formats unless you plan to edit a resource script file in a text
editor. For information about resource script formats, search online Help for “Editing a
resource as text.”
In Resource Workshop, you can create and edit resource scripts using the Dialog, Menu,
Accelerator, Graphic, String, and Script editors. Use the Graphic editor to work with

Chapter 9, An overview of working with resources 135


bitmaps, cursors, icons, and fonts; use the Script editor to work with raw resource
scripts, including resource scripts for version information and custom data types.
Unlike a text editor, most Resource Workshop editors are graphical; they allow you to
work with resources just as they appear in an application. When you save your work in
Resource Workshop, you can create a resource script file automatically. The file contains
resource scripts that correspond to the resources you define in the Resource Workshop
editors.
In addition to resource scripts, a resource script file can contain one or more identifiers.
An identifier is a unique name or number that you can use in code to refer to a resource.
In Resource Workshop, you can have identifiers created automatically when you add
new resources, or you can create identifiers manually. For more information about
automatically creating identifiers, see the section “Setting general environment options”
on page 144.
Note You can’t refer to a resource in code unless the resource has a corresponding identifier.
The following sections show how to
• Create a new resource script file
• Edit an existing resource script file
• Generate binary resources from a resource script file

Creating a resource script file


To create a resource script file,
1 Choose File|New Project.
2 Select RC.
3 Choose OK.
The Add File To Project dialog box appears.
4 If you want to store identifiers in a separate file, type the name of a resource header
file in the File Name box, and choose OK. (Just like standard C header files, the
resource header file can contain identifiers.) Otherwise, choose Cancel.
You can add resource header files later by using the File|Add To Project command.
For more information, see the section “Adding an identifier” on page 140.
5 Choose File|Save Project.
6 In the File Name box, type a name for the new resource script file.
7 Choose OK.
Now you have an empty resource script file to which you can add resource scripts and
identifiers.

Editing an existing resource script file


To edit an existing resource script file,

136 User’s Guide


1 Choose File|Open Project.
2 In the File Type box, choose RC resource script.
3 In the File Name box, type the resource script file name. Or select the file name using
the Files and Directories boxes.
4 Choose OK.
5 Add, edit, or remove resource scripts and identifiers from the resource script file.
These procedures are described in the following sections.
6 Choose File|Save Project.

Adding resource scripts


You can add resource scripts to a resource script file directly or indirectly. When you
add resource scripts to a resource script file directly, the corresponding data is included
in the current resource script file. When you add resource scripts indirectly, you can
access the corresponding data from the current resource script file, but the data is stored
in a separate resource script file.
If you want to keep your resource scripts together, you should add them directly to a
single resource script file. On the other hand, if you want to share resource scripts
among several resource script files, you should add the resource scripts indirectly to
each file.

Adding a new resource script indirectly


To add a new resource script indirectly,
1 Create or open the resource script file.
2 Choose File|Add To Project.
3 In the File Type box, choose RC Resource Script.
4 Type a name for the new resource script file. The file name must be unique from
other files in the current directory.
5 Choose OK.
A dialog box asks whether you want to create a new resource script file.
6 Choose Yes.

Adding one or more existing resource scripts indirectly


To add one or more existing resource scripts indirectly,
1 Open the resource script file.
2 Choose File|Add To Project.
3 In the File Type box, type the name of the file that contains the resource script(s). Or
select the file using the Files and Directories boxes. You can specify a resource script,
binary, or graphic file. All resource scripts in the file will be added indirectly to the
current resource script file.

Chapter 9, An overview of working with resources 137


4 Choose OK.
Note If a file contains more resource scripts than you need, you can use the Resource|Save
Resource As command to separate some resource scripts into new files. Then you can
add the new files indirectly to the current resource script file.

Adding a new resource script directly


To add a new resource script directly,
1 Create or open the resource script file.
2 Choose Resource|New.
3 In the Resource Type box, select a resource type.
4 Choose the resource script file to which you want to add the new resource script. You
can choose the current resource script file or any file containing resource scripts that
have been added indirectly to the current project.
5 Choose OK.
6 If you’re embedding a definition for a graphic, choose Source. You can also add the
graphic to the current resource script file by choosing Binary, but this choice adds the
new graphic indirectly.
7 If you’re embedding a definition for a bitmap or icon, specify size and color options,
and then choose OK. If you don’t know which size and color options to specify,
accept the default values. For information about changing the size and color options,
see “Changing the properties of a bitmap” on page 196 or “Changing the properties
of an icon” on page 197.

Adding an existing resource script directly


To add an existing resource script directly, copy or move the resource script from one
file to another.
To copy or move a resource script,
1 Open the file that contains the resource script. (You might want to save the current
file first.)
2 In the Project window, select the resource script.
3 Choose Edit|Copy (to copy the resource script) or Edit|Cut (to move the resource
script).
4 Open the file to which you want to copy or move the resource script.
5 Choose Edit|Paste.
Note You can only paste a resource script into a file with a compatible format. For example,
you can’t paste an icon script into a bitmap file.

Editing a resource script


You can edit a resource script by using one of the Resource Workshop editors or by
specifying memory or language options.

138 User’s Guide


To edit a resource script in a Resource Workshop editor,
1 In the Project window, double-click the resource script.
2 Follow the instructions in the appropriate chapter of this book (see the following
table).

For information about working with See


Dialog boxes Chapter 10
Menus and accelerators Chapter 11
Strings Chapter 12
Bitmaps, icons, cursors, and fonts Chapter 13
Version information and custom data types Chapter 14

Specifying memory options


Each resource script includes information about how the resource is handled in
memory.
To specify memory options for a resource script,
1 In the Project window, select the resource script.
2 Choose Resource|Memory Options.
3 Select or deselect the following memory options:

Option Description
Loaded on call The resource is loaded into memory when needed for the first time. If a resource is
not loaded on call, it is loaded when the application starts. If an application doesn’t
need the resource immediately, you should select this option so that the application
is launched more quickly.
Moveable The resource can be moved in memory. By allowing a resource to be moved in
memory, you can increase the efficiency with which the application uses memory;
however, it’s harder to track the exact location of the resource in memory.
Discardable The resource can be removed from memory. (If no longer in memory when needed,
the resource is automatically reloaded.) By allowing a resource to be discarded from
memory, you can decrease the amount of memory an application needs at one time;
however, if a system runs low on memory, the application will run more slowly
when reloading resources.
Pure The resource can’t be changed in memory.

4 Choose OK.

Specifying a language version


For a Win32 application, you can create resources with different versions for each
language, such as French, German, Spanish, and so on. A Win32 application
automatically uses the resources that correspond to the system on which it runs. For
example, a Win32 application running on a French system automatically uses the
French versions of resources. (To set the system language, use the International settings
in the Windows Control Panel.)
Note You can use Win32 resources with Borland C++, but not with Turbo C++.

Chapter 9, An overview of working with resources 139


To specify a language version for a Win32 resource script,
1 In the Project window, select the resource script.
2 Choose Resource|Language.
3 Choose a major language or Neutral. (A resource with a Neutral language version
works on all systems.)
A major language is a language with one or more dialects. For example, the English
major language has dialects for Australia, Canada, New Zealand, the United
Kingdom, and the United States.
4 Choose a minor language or Neutral.
A minor language is a particular dialect within a major language.
5 Choose OK.

Removing a resource script


To delete a resource script from a resource script file,
1 In the Project window, select the resource script.
2 Press Del.

Adding an identifier
If you’re not generating identifiers automatically or if you want to create identifiers for
resources that don’t exist yet, you need to add identifiers manually.
To add an identifier to a resource header or resource script file,
1 Choose Resource|Identifiers.
2 Choose New.
3 In the Name box, type a name for the identifier. You can use alphanumeric characters
and the underscore character. The identifier name can’t begin with a number, and
any characters past the 31st character are ignored.
4 In the Value box, type a value for the identifier. You can choose any value that is not
already used.
5 Choose a resource script or header file in which to store the identifier.
6 Choose OK.
7 Choose Done.
You can also add an existing identifier by moving it from one resource script or resource
header file to another. To move an identifier, choose Resource|Identifiers and use the
Move button.
Note You can control which information appears in the Identifiers dialog box by setting the
View and Sort options. For more information about these options, choose Resource|
Identifiers, and then choose Help.

140 User’s Guide


Depending on how you want to organize identifiers and which identifiers you’ve
already defined, you might want to add a new or existing resource header file to the
current resource script file.
To add a new or existing resource header file to the current resource script file,
1 Choose File|Add To Project.
2 In the File Type box, choose RH, H C Header.
3 In the File Name box, type the name of the new or existing resource header file.
4 Choose OK.
5 If you’re adding a new resource header file, a dialog box warns you that the resource
header file doesn’t currently exist. Choose Yes to create the new resource header file.

Editing an identifier
You can edit a resource identifier by changing its value or name. You may want to
change the value of an identifier to keep related resources together; you might want to
change the name of an identifier to more accurately reflect the resource to which it
refers.
To edit a resource identifier,
1 Choose Resource|Identifiers.
2 Select the identifier.
3 Choose Change or Rename.
4 Type a new value or name for the resource identifier.
5 Choose OK.
6 Choose Done.
Note You can control which information appears in the Identifiers dialog box by setting the
View and Sort options. For more information about these options, choose Resource|
Identifiers and then choose Help.

Removing an identifier
If you remove a resource script from a resource script file, you should also remove its
identifier.
To remove a resource identifier,
1 Choose Resource|Identifiers.
2 Select the identifier.
3 Choose Delete.
4 If the identifier is assigned to a resource, a warning box appears. Choose Yes to delete
the identifier.
5 Choose Done.

Chapter 9, An overview of working with resources 141


Note You can control which information appears in the Identifiers dialog box by setting the
View and Sort options. For more information about these options, choose Resource|
Identifiers, and then choose Help.

Generating binary resources from a resource script file


After you add one or more resource scripts and identifiers to a resource script file, you
can compile the resource script file into one or more binary resources, link the binary
resources to an application, and then refer to the resources in the application’s code by
using the corresponding identifiers.
To generate resources from a resource script file, include the resource script file as a
node in an IDE application project. The next time you compile the application, the
resource scripts in the resource script file are automatically compiled and linked to the
application. For more information about adding a node to an IDE application project,
see “Adding source nodes to your project” on page 24.
Note To refer to resources in code, you must include the corresponding resource header file(s)
in your C or C++ source files.

Working with binary files


In Resource Workshop, you can edit resources in a compiled resource script file (.RES),
.EXE, .DLL, or other binary file. You can also create a .RES file directly.

Creating a .RES file


To create a .RES file,
1 Create or open a resource script file. For information about resource script files, see
“Working with resource script files” on page 135.
2 Choose File|Save File As.
3 In the File Type box, choose RES Resource Object.
4 In the File Name box, type a file name for the binary resource file.
5 Choose OK.

Editing resources in a binary file


In Resource Workshop, you can edit the resources in a binary file even if you don’t have
the resource script files from which the resources were generated.
To edit resources in a binary file,
1 Choose File|Open Project.
2 In the File type box, choose the type of binary file that you want to edit.

142 User’s Guide


3 In the File name box, type the binary file name. Or select the file name using the Files
and Directories boxes.
4 Choose OK.
5 In the Project window, double-click a resource that you want to edit.
6 Edit the resource by using one of the Resource Workshop editors.
7 Choose File|Save Project.
The resources are automatically recompiled and relinked to the original binary file.
Note When working with binary files, you can’t add resource scripts indirectly or create
identifiers. However, you can save a binary file as a resource script file by using the
File|Save File As command.

Working with graphic files


A graphic file is a bitmap (.BMP), icon (.ICO), cursor (.CUR), or font (.FNT) file. You can
add a graphic file to a resource script file to create a graphic resource, which you can
then use in an application. For more information about adding a graphic file to a
resource script file, see the section “Adding resource scripts” on page 137.
You can also use graphic files in many applications besides Resource Workshop. For
example, you can include bitmaps in most word-processor documents.

Creating a graphic file


To create a graphic file,
1 Choose File|New Project.
2 Select a graphic file type.
3 Choose OK.
4 If you’re creating a bitmap or icon file, specify size and color options, and then choose
OK. If you don’t know which size and color options to specify, accept the default
values. For information about changing the size and color options, see the section
“Changing the properties of a bitmap” on page 196 or “Changing the properties of an
icon” on page 197.
5 Choose File|Save Project.
6 In the File Name box, type a name for the new graphic file.
7 Choose OK.
You can also create a graphic file by opening a binary or resource script file that contains
a graphic, selecting the graphic in the Project window, and then saving the graphic in a
graphic file using the Resource|Save Resource As command.

Chapter 9, An overview of working with resources 143


Editing a graphic file
To edit a graphic file,
1 Choose File|Open project.
2 In the File Type box, choose the graphic file type.
3 In the File Name box, type the graphic file name. Or select the file name using the
Files and Directories boxes.
4 Choose OK.
5 Use the graphic editing tools, which are described in Chapter 13, “Working with
graphics,” on page 187.
6 Choose File|Save Project.

Customizing Resource Workshop


You can customize Resource Workshop by specifying which information appears in the
Project window, and by setting general environment options.

Specifying which information appears in the Project window


If there is an open file in Resource Workshop, you can specify which information
appears in the Project window by using the commands in the following table:

Use this command To


View|By Type or View|By File Group resource scripts by type (dialog boxes, menus, accelerators, and
so on), or by file (first file, second file, and so on).
View|Show Identifiers Show the identifiers in the current resource script file.
View|Show Resources Show the resource scripts in the current resource script file.
View|Show Items Show individual items in resource scripts, such as the individual
commands on menus, strings in a string table, and accelerators in an
accelerator table.
View|Show Unused Types Show placeholders in the Project window for resource types that have
not been added to the current resource script file.
View|Show Vertical Preview, Hide the Preview pane of the Project window or display the Preview
View|Show Horizontal pane horizontally or vertically. (The Preview pane shows a miniature
Preview, or View|Hide version of the selected resource as it appears in the corresponding
Preview Resource Workshop editor.)

Setting general environment options


To set general environment options,
1 Choose File|Preferences.

144 User’s Guide


2 Set any of the following options:

Option Settings
Undo Levels 1–99. The maximum number of Undo levels may be limited by available
memory.
Text Editor The full path and file name of a text editor. You will be given the option of
editing the resource script file in the text editor if an error occurs during
the resource compilation process. By default, the text editor is the
Windows Notepad.
Include Path The path(s) where Resource Workshop looks for resource files. You can
specify the include path only when there are no open files.
Multi-Save Whether or not the current resource file is saved automatically in an
additional compiled resource script (.RES), binary file, or backup file.
(Backup files have a tilde (~) as the first character in the file name
extension.)
Automatic Identifier Whether or not identifiers are automatically created when you add new
Management resource scripts. If you turn on this feature, you won’t have to manually
create identifiers for new resource scripts.
Target Windows Version Whether new resource script files are for Windows 3.0, Windows 3.1, or
Win32 applications. You can specify the Windows version only when
there are no open files. Win32 resource script files work with Borland C++,
but not with Turbo C++.
Language for Win32 The default major and minor languages for new resource scripts. You can
specify the default languages only after targeting Win32. For more
information, see the section “Specifying a language version” on page 139.
Win32 resource script files work with Borland C++, but not with Turbo
C++.

3 Choose OK.

Chapter 9, An overview of working with resources 145


146 User’s Guide
Chapter

Working with dialog boxes


Chapter 10
10
A dialog box is a pop-up window that uses labels, text boxes, buttons, check boxes, scroll
bars, and other controls to give information to and receive information from a user. You
can create a dialog box that pops up when a menu command is chosen or when an event
occurs in an application. You can also create a dialog box that serves as the main
window of an application.
Like other resources, you define a dialog box with a resource script. This chapter
describes how to edit and test a dialog box resource script, and how to use the
corresponding resource in an application.

Editing a dialog box resource script


You edit a dialog box resource script by using the Dialog editor.
To start the Dialog editor,
1 Create a resource script file and add a dialog box resource script. Or open a resource
script file that contains a dialog box resource script.
2 If the Dialog editor doesn’t start automatically, double-click a dialog box resource
script in the Project window.

Chapter 10, Working with dialog boxes 147


The Dialog editor appears. It contains a dialog box template, Tools palette, and
Alignment palette.
Dialog editor window

Alignment palette

Dialog box template

Tools palette

The Tools palette has the following tools:

Selector Push Button Radio Button Borland Group Box

Tab Set Horizontal Scroll Bar Vertical Scroll Bar Horizontal Line

Set Groups List Box Check Box Vertical Line

Set Order Group Box Combo Box Borland Push Button

Test Edit Box Static Text Borland Radio Button

Duplicate Icon Frame Borland Check Box

Undo Rectangle Custom Control Borland Static Text

The Alignment palette has the following tools:


Align Centers Center in Dialog Box
Horizontally Horizontally

Align Left Sides Align Right Sides

Align Top Sides Align Bottom Sides

Align Centers Center in Dialog Box


Vertically Vertically

After you start the Dialog editor, you can edit a dialog box resource script by
• Setting dialog box properties
• Moving and resizing the dialog box
• Adding controls to the dialog box
• Moving, resizing, aligning, and grouping controls

148 User’s Guide


• Setting the Windows classes of controls
• Setting control properties
To customize the Dialog editor, see “Customizing the Dialog editor” on page 169.

Setting dialog box properties


To set the properties of a dialog box, double-click its title bar or outer edge, and then use
the Window Style dialog box. You can set any of the properties described in the
following sections.

Class property
You can specify bordlg, BorDlg_Gray, or your own custom window class. If you don’t
specify a class, the dialog box uses the standard Windows class.
The bordlg class improves the appearance of your dialog box by painting the
background with a brush that varies according to the target display device. For screens
of VGA and higher resolution, the background is a fine grid of perpendicular white
lines, giving the effect of chiseled steel. For EGA and monochrome screens, the
background is white. The bordlg class also optimizes the drawing of your dialog box by
calling the custom control drawing routines directly instead of waiting for Windows to
paint the controls.
The BorDlg_Gray class gives the dialog box a gray background in addition to the
features of the bordlg class.
For information about creating Window classes, search Win32 Online Help
(WIN32.HLP) for “Windows Classes.”

Menu property
Like other windows, a dialog box can have menus. Menus are particularly useful for
dialog boxes that serve as the main window of an application.
To add menus to your dialog box, specify the identifier or unique number of a menu
resource. For information about menu resources, see “Working with menus and
accelerator tables” on page 171.

Type property
You can set the Type property to one of the following values:

Value Description
Popup A pop-up window. Because most dialog boxes are pop-ups, this is the default.
Child A child of the current window.
Overlapped An window that can be covered by another window. You’ll want to set the Type property
to overlapped only for the main window in an application.

Chapter 10, Working with dialog boxes 149


Style properties
You can turn the following style properties on or off:

Property Description
System Menu Includes a System menu box to the left of the title bar (appears only if you’ve also
chosen Caption for the Frame Style property). If the dialog box is a child window, a
Close box appears instead of a Control menu.
Thick Frame Places a thick frame around the dialog box. This option defines what the user will see
when the dialog box appears within an application. If you want the dialog box to be
resizable, use this option. (Don’t confuse this option with the Thick Frame option in
the Dialog editor Preferences command. That option defines what the dialog box
looks like when you select it in the Dialog editor.)
Vertical Scroll Adds a vertical scroll bar to the dialog box frame.
Horizontal Scroll Adds a horizontal scroll bar to the dialog box frame.
Minimize Box Adds a Minimize button on the right side of the title bar. The Minimize button
appears only if you’ve also chosen Caption for the dialog box frame style.
Maximize Box Adds a Maximize button on the right side of the title bar. The Maximize button
appears only if you’ve also chosen Caption for the dialog box frame style.
Absolute Align Makes the dialog box coordinates relative to the display screen rather than the parent
or owner window.
System Modal Makes the dialog box system modal, meaning that the user can’t do anything else
until the dialog box is closed.
Local Edit Allocates any edit text controls included in this dialog box to the application’s local
heap. Choose Local Edit if your application needs to use EM_SETHANDLE and
EM_GETHANDLE messages.
Modal Frame Frames the dialog box with a combination of the dialog box frame and caption styles
(default).
No Idle Messages Suppresses sending WM_ENTERIDLE messages to the application’s main dialog
box. The dialog box must be modal for this option to take effect.
Clip Children Protects the client area of child dialog boxes from being drawn on by the Parent
dialog box.
Clip Siblings Protects the siblings of this window. Drawing is restricted to this window. This
option is not required for dialog boxes, but can be useful for child dialog windows.
Visible Makes a modeless window visible before the return from CreateDialog. This option
has no effect on modal windows (the usual kind of dialog box). By default, this option
is not checked (NOT WS_VISIBLE).

Frame Style property


You can set the Frame Style property to one of the following values:

Value Description
Dialog frame A double border without a title bar
Border A single, thin border without a title bar
Caption A single, thin border and a title bar where a caption can be displayed (default)
No border No border or title bar

Font properties
You can set the Font Name and Font Size properties by choosing the Font button,
selecting a font name and size, and then choosing OK.

150 User’s Guide


Extended Style property
If you’re creating resources for a Win32 application (see page 169), you can set the
Extended Style property to one of the following values:

Value Description
WS_ES_ACCEPTFILES This dialog box accepts drag and drop files.
WS_EX_DLGMODALFRAME This dialog box has a double border that can (optionally) be created with
a title bar by specifying the WS_CAPTION style flag in the c-style
parameter.
WS_EX_NOPARENTNOTIFY A child window created by using this style will not send the
WM_PARENTNOTIFY message to its parent window when the child
window is created or destroyed.
WS_EX_TOPMOST A window created with this style should be placed above all non-
topmost windows and stay above them even when the window is
deactivated. An application can use the SetWindowPos function to add or
remove this attribute.
WS_EX_TRANSPARENT A window created with this style is transparent, so that any windows
beneath it are not obscured by the window. A window created with this
style receives WM_PAINT messages only after all sibling windows
beneath it have been updated.

Common properties
In addition, you can set any of the common properties for the dialog box, which are
described page 160.

Moving and resizing a dialog box


You can move or resize a dialog box just as you would move or resize a control. For
more information, see page 155.
If you set the Type property of the dialog box to Overlapped, you can let Windows
control the position of the dialog box on the screen. Select the dialog box, choose Align|
Size, select the Set by Windows box, and then choose OK.

Adding a standard control to a dialog box


To add a standard control to a dialog box,
1 In the Tools palette, select the control. (The controls are described in a table in this
section.)
2 Drag the mouse in the dialog box template.
If you select a control from the Tools palette and then change your mind about placing
it, press Esc.

Chapter 10, Working with dialog boxes 151


You can add any of the following controls:

Control Description
Push button A rectangular button the user “presses” to select an action. You can create a standard or
Borland push button. Unlike a standard push button, a Borland push button has a
minimum size of 26x14 dialog units. You can more easily add bitmaps to a Borland push
button.
Radio button A button that is used in groups to represent mutually exclusive options. You can create a
standard or Borland radio button. A standard radio button is circular. A Borland radio
button is a three-dimensional diamond. For information about grouping radio buttons,
see the section “Grouping and ungrouping controls” on page 157.
Check box A square box that represents an option that can be turned on or off. You can create a
standard or Borland check box. When a standard check box is selected, an X appears in
the square. When a Borland check box is selected, a check mark appears in the square.
When a check box is not selected, the square is empty.
Static text A fixed text string. You can create a standard or Borland static text control. Unlike a
standard static text control, a Borland static text control is shaded.

Group box A box that is used to group controls visually. You can create a standard or Borland
group box. Unlike a standard group box, a Borland group box is shaded and has a three-
dimensional effect.

Scroll bar A rectangle with direction arrows at each end. Between the arrows, a square icon, called
the scroll box or thumb, indicates the approximate position of the display relative to the
full range of information. You can create a horizontal or vertical scroll bar.

Edit box A box in which the user can edit text.

List box A box that contains a list of items from which the user can choose.

Combo box A box in which a user can type or select an item.

Icon An icon.

Frame A rectangular frame with the same color as the dialog box frame.

Rectangle A rectangle with the same color as the dialog box frame.

Line A line used to separate items in a dialog box. You can create a horizontal or vertical line.

152 User’s Guide


The advantages of using Borland controls
Borland controls add a three-dimensional effect to your dialog boxes, giving more
visual impact. Borland controls work like standard Windows controls, but they provide
you with an additional level of control over keyboard focus and tab movement. To use
the full capabilities of a Borland control, you must select the Parent Notify property
using the Style window for the control. For more information, see “Setting common
properties using the Style window” on page 161.
A Borland control can send the following messages to your dialog box:

Message Description
BBN_SETFOCUS Indicates that the Borland control has gained keyboard focus through an
action other than a mouse-click.
BBN_SETFOCUSMOUSE Indicates that the Borland control has gained keyboard focus through a
mouse-click.
BBN_GOTATAB Indicates that the user pressed Tab while the Borland control had the
keyboard focus. The parent window can intervene in the processing of the
keystroke by returning a nonzero value.
BBN_GOTABTAB Indicates that the user pressed Shift+Tab while the Borland control had the
keyboard focus. The parent window can intervene in the processing of the
keystroke by returning a nonzero value.

Working with custom controls


In addition to standard and Borland controls, you can add custom controls to a dialog
box template. A custom control is any other window class that you want to add to your
dialog box. You can create your own custom controls or buy custom controls from a
third-party vendor.
The Borland Visual Solutions Pack, which is sold separately, contains many custom
controls, including
• A WYSIWYG word processor with separate status bar, button bar, and ruler controls.
All four controls are integrated and interface seamlessly, requiring minimal
programming.
• A full-featured spreadsheet with multiple worksheets, and a calculation engine that
includes a comprehensive set of worksheet functions.
• Twelve database controls that let you add sophisticated database front-ends quickly
and with virtually no coding. These controls provide substantial database
functionality, including visual generation of simple or master-detail forms, binding
fields to database columns, and performing queries by form.
• Notebook tabs that help you organize user interface components into folders or other
groupings.

Installing a control library (.DLL or .VBX)


Custom controls are stored in .DLL or Visual Basic custom control (.VBX) files. Before
you can use custom controls in Resource Workshop, you must install them.
To install custom controls,

Chapter 10, Working with dialog boxes 153


1 Choose File|Install Control Library.
2 In the File Name box, type the name of the .DLL or .VBX file. Or select the file using
the Files and Directories boxes.
3 Choose OK.
Now you can add the controls contained in that .DLL or .VBX file to your dialog box.

Adding a custom control to a dialog box


If a custom control is recognized by Resource Workshop, its icon appears in a column on
the right side of the Tools palette. You can add the custom control to your dialog box by
selecting it, and then dragging the mouse in the dialog box template.
However, if a custom control is not recognized by Resource Workshop, its icon does not
appear in the Tools palette, and you’ll need to follow these steps to add the custom
control to your dialog box:
1 Click the Custom Control tool or choose Control|Custom.
2 In the Class box, choose the custom control.
Custom
Control Resource Workshop displays a sample of the custom control you’ve selected in the
tool middle of the dialog box.
3 Choose OK.
4 In the dialog box template, drag the mouse where you want to place the custom
control.
An icon representing the custom control appears in the dialog box template.

Creating custom controls


To create custom controls, you must design and store them in dynamic-link library
(.DLL) files. The process of creating custom controls is described in the BWCC reference
in online Help (BWCC.HLP).

Selecting controls
Many editing options require that one or more controls be selected. For example, you
must select a control before you can change its size, and you must select at least two
controls before you can align them relative to each other.
To select a single control,
1 Choose the Selector tool.
2 Click the control.
A selection frame appears around the control you select.
Selector
tool To select one or more controls,
1 Choose the Selector tool.
2 Click on a control to make sure the dialog box template is not selected.

154 User’s Guide


3 Drag a rectangle around the controls you want to select. Depending on the current
state of the Selection Rectangle Surrounds check box in the Options|Preferences
dialog box, the selection rectangle must either entirely surround the controls or just
touch them.
A selection frame appears around the controls you select.
You can also perform the following selection actions:

To Perform this action


Add or remove a single control Shift+click the control.
from a selected group
Select all the controls in a Choose Edit|Select All.
dialog box
Move the selection frame Press Tab (to select the next control in the tab order) or Shift+Tab (to select
the previous control in the tab order).
If the current selection includes more than one control, the selection
frame moves to the control that precedes or follows the highest one in the
current selection. However, if the current selection includes controls
selected with Shift+click, the selection frame moves to the control that
precedes or follows the last control you selected. For more information
about the tab order, see “Setting the tab order of controls” on page 157.

Moving controls
You can move selected controls by dragging anywhere inside the selection frame. As
you drag, the controls move together, maintaining their positions relative to each other.
To move a control with the keyboard, press Tab to select the control, then use the arrow
keys to move the control, and press Enter.

Resizing controls
You can resize controls with the options in the Size Controls dialog box:
1 Select the controls you want to resize.
The selection frame surrounds the selected controls. The individual controls that are
affected by the resizing options have shaded outlines.
2 Choose Align|Size. Choose the Vertical Size and Horizontal Size options you want
and click OK to resize the selected controls.

Horizontal size
options Description
No Change Prevents horizontal size change.
Shrink to Smallest Reduces width of controls to match the least wide of the selected controls.
Grow to Largest Increases width of controls to match the widest of the selected controls.
Width of Size Box Resizes controls so they are as wide as the selection frame.
Width of Dialog Resizes controls so they are as wide as the dialog box.

Chapter 10, Working with dialog boxes 155


Vertical size options Description
No Change Prevents vertical size change.
Shrink to Smallest Reduces height of controls to match the least tall of the selected controls.
Grow to Largest Increases height of controls to match the tallest of the selected controls.
Height of Size Box Resizes controls so they are as tall as the selection frame.
Height of Dialog Resizes controls so they are as tall as the dialog box.

If you select a single control and then choose Align|Size, the following options are
available:
• No Change (Horizontal and Vertical)
• Width of Dialog (Horizontal)
• Height of Dialog (Vertical)
• Enter Values (Horizontal and Vertical)
The No Change, Width of Dialog, and Height of Dialog options are described in the
preceding tables.
The Enter Values options let you specify both the size and position of the selected
control. The X- and Y-values set the distance of the upper left corner of the control from
the upper left corner of the dialog box (directly below the title bar). The CX- and CY-
values set the width and height of the control. All values are measured in pixels or
dialog units.

Fine-tuning the size of controls


You can use the keyboard and mouse together to fine-tune the size of a control:
1 Select the control and move the mouse pointer over an edge or corner of the control.
The cursor becomes a double-headed arrow.
2 Hold down the left mouse button and press an arrow key. Each time you press the
arrow key, the selection frame moves a single pixel or dialog unit.

Moving and resizing controls at the same time


You can specify the position and size of a control at the same time:
1 Select the control.
2 Choose Align|Size or hold down the Alt key while double-clicking the mouse.
The Size Controls dialog box appears.
3 To set the position of the upper left corner of the control, specify its X- and Y-
coordinates in pixels or dialog units. The coordinates 0,0 place the control in the
upper left corner of the dialog box, directly below the title bar.
4 To set the control’s width and height, specify its CX- and CY-values in pixels or
dialog units.

156 User’s Guide


Grouping and ungrouping controls
You can group controls to let the user move among them using the arrow keys.
To group controls,
1 Click the Set Groups tool or choose Options|Set Groups.
2 Click a control that is not surrounded by a shaded outline.
Set To ungroup controls,
Groups
tool 1 Click the Set Groups tool or choose Options|Set Groups.
2 Click a control that is surrounded by a shaded outline.
You can also set the Group property using the Style window. For more information
about the Style window, see “Setting common properties using the Style window” on
page 161.
Note You mark only the first control in each group with the Group attribute. Controls are
included in the group according to the order in which they are added to the dialog box.
For example, if you add seven controls to your dialog box and then turn on the Group
property of the first and fifth controls, the first four controls are included in the first
group, and the remaining controls are included in the second group.

Setting the tab order of controls


You can specify the order in which users can tab to the controls in a dialog box.
To specify the tab order of the controls in your dialog box,
1 Select the controls whose tab order you want to change. To specify the order for all
controls in the dialog box, don’t select any controls.
2 Click the Set Order tool. Or choose Options|Set Order.
Each control you selected is numbered to show its current place in the overall order.
Set Order Note the Next Item prompt at the bottom of the Dialog editor. It tells you the number
tool that will be assigned to the next control you select.
3 Click the controls to which you want to assign numbers.
While assigning new order numbers, you can “step back” by re-clicking the last
control you just clicked. The order changes to its previous number. You can continue
to backtrack by clicking the controls in the reverse order that you originally clicked
them.
4 When you’re done assigning numbers, click the Selector tool to return to selection
mode.

Aligning controls
You can align controls on the dialog box template so they are more visually appealing.
You align controls with the Align|Align command, the Alignment palette, and the grid.
These alignment methods are described in the following sections.

Chapter 10, Working with dialog boxes 157


Aligning controls with the Align|Align command
To align your controls with the Align|Align command,
1 Select the controls you want to align.
A selection frame surrounds all the selected controls. The individual controls you can
align are shaded.
2 Choose Align|Align. The Align Controls dialog box appears.
3 Choose the Vertical Alignment and Horizontal Alignment options you want, and
then choose OK.

Horizontal
alignment option Description
No Change Affects no change in horizontal alignment.
Left Sides Aligns the controls so their left sides are on the left of the selection frame.
Centers Aligns the controls so their horizontal centers are in the center of the selection
frame.
Right Sides Aligns the controls so their right sides are on the right side of the selection frame.
Space Equally Moves the controls horizontally within the selection frame so the spaces between
them are equal.
Center In Dialog Centers the selection frame horizontally in the dialog box. The relative position
of the individual controls within the selection frame is unchanged.

Vertical
alignment option Description
No Change Affects no change in vertical alignment.
Tops Aligns the controls so their tops are at the top of the selection frame.
Centers Aligns the controls so their vertical centers are in the center of the selection
frame.
Bottoms Aligns the controls so their bottoms are at the bottom of the selection frame.
Space Equally Moves the controls vertically within the selection frame so the spaces between
them are equal.
Center In Dialog Centers the selection frame vertically in the dialog box. The relative position of
the individual controls within the selection frame is unchanged.

Aligning controls with the Alignment palette


You can also align controls using the Alignment palette. Select the controls you want to
align and then choose a tool from the Alignment palette.
The Space Equally option is not in the Alignment palette. However, you can use the
Align Controls dialog box as explained in the previous section, or you can space controls
equally by stretching the selection frame.
To space controls equally by stretching the selection frame,
1 Select the controls you want to space equally.
A selection frame surrounds your selected controls.

158 User’s Guide


2 Stretch the selection frame by holding down the Ctrl key while dragging the edge of
the selection frame in the direction you want to space your controls:
• To space the controls equally in the horizontal direction, stretch the right or left
border of the selection frame.
• To space the controls equally in the vertical direction, stretch the top or bottom
border of the selection frame.
If you stretch a corner of the selection frame, the Form Controls into an Array dialog box
appears, ready for you to arrange your controls in rows and columns.

Aligning controls with the grid


To align controls with the grid,
1 Choose Align|Grid. The Set Grid Attributes dialog box appears.
2 Specify the width and height of a grid cell (in dialog units).
3 Select the Grid Type:
• Absolute. Snaps the control to the nearest grid line.
• Relative. Moves the control only in increments of the grid width horizontally and
the grid height vertically. Therefore, if a control was not placed on a grid line
originally, you will not be able to move it to a grid line with this option selected.
For example, if you set the grid to be 4x4 and have a control with a position of
(1,1), when you move the control, it will only go to positions that are 4 units away
in either dimension. Possible coordinates would be (5,5), (5,9), (9,5), and so on.
4 Select the Show Grid option and choose OK.
5 Align controls by moving them around in the dialog box template. (You can move
controls by dragging them or by selecting them and pressing the arrow keys.)

Aligning controls in columns and rows


The Align|Array command arranges controls in columns and rows, aligning them
horizontally or vertically, spacing them evenly horizontally or vertically, and
renumbering them so they are all in sequence.
To use the Align|Array command
1 Select the controls you want to arrange in columns and rows.
The selection frame surrounds the selected controls. The individual controls that will
be affected by the Array command are indicated by shaded outlines.
2 If necessary, enlarge or reduce the size of the selection frame to enclose the area you
want to fit the columns and rows into. For example, if you make the selection frame
larger, the Array command will move the controls out to the new boundaries set by
the selection frame.
3 Choose Align|Array or click the Duplicate tool.
4 Under Array Layout, specify the number of rows and columns you want.
Duplicate
tool 5 Under Order, select how to order the controls in this group.

Chapter 10, Working with dialog boxes 159


6 After you’ve chosen the options for the array, choose OK.
Note For multiple selected controls, the Duplicate tool has the same effect as Align|Array.
When only a single control is selected, it has the same effect as Edit|Duplicate.

Undoing actions
You can “undo” any editing you do in the Dialog editor, such as placing controls,
aligning them, deleting controls, and so on, with the Undo tool or the Edit|Undo
command.
Undo tool
To specify the number of actions that you can undo, use the File|Preferences command.
For more information, see “Customizing Resource Workshop” on page 144.

Setting the Windows class of a control


If you’re an advanced Windows programmer, you may want to set the Windows class
of a control.
For information about creating Window classes, search Win32 Online Help
(WIN32.HLP) for “Windows Classes.”
To set the Windows class of a control,
1 Hold down Ctrl and double-click the control.
2 In the Class box, type the name of a Windows class.
Note In the Generic Control Style window, you can also specify a caption, control ID, and
style. If you type anything next to Info, the dialog box won’t be compatible with the
Microsoft Resource Compiler.

Setting common properties using the Properties window


The standard controls share common properties that you can set using the Properties
window.
To set a common property using the Properties window,
1 Select the control.
2 In the Properties window, select the property.
3 In the Properties window text box, type a value for the property.
Note If the Properties window is not visible, choose Options|Show Properties.

Property Description
Caption Text to display on or next to the control. Different types of controls have
captions in different areas. For example, in a group box, the caption is at the top
left. In a push button, the caption is inside the button.
Height The height of the control in pixels or dialog units.

160 User’s Guide


Property Description
ID source / Control ID The identifier for the control. For more information about identifiers, see
“Creating a resource script file” on page 136. For information about special
identifiers for Push button controls, see the section “Push button properties” on
page 162.
ID Value The unique number for the control.
Left The distance of the control from the left edge of its parent window in dialog
units or pixels.
Tab Stop Whether the user can use the Tab key to select the control.
Top The distance of the control from the top edge of its parent window in dialog
units or pixels.
Visible Whether the control is visible.
Width The width of the control in dialog units or pixels.

Setting common properties using the Style window


In addition to the common properties that you can set in the Properties window, each
control has additional properties that you can set only in the Style window.
To set a common property using the Style window,
1 Double-click the control. The Style window appears.
2 In the Attributes group, set any of the properties described in the following table.

Property Description
Caption Type Whether the caption is text or a number.
Horizontal Scroll Bar Whether the control has a horizontal scroll bar.
Vertical Scroll Bar Whether the control has a vertical scroll bar.
Alignment Whether text is aligned to the right, left, or center of the control.
Owner Drawing The amount of control the application has over the appearance of the control. For
more information about the Owner Drawing property, choose the Help button on
the Style window.
Owner Draw Whether the application handles the appearance of the control. When the Owner
Draw is selected, the control sends a WM_DRAWITEM message to its parent.
Parent Notify Whether the control generates the following Windows messages:
BBN_SETFOCUS, BBN_SETFOCUSMOUSE, BBN_GOTATAB, GOTABTAB. The
parent notify property is available with Borland controls only.
No Character The No Character Underline check box turns off character underlining. You can
Underlining underline a text character in your static control by preceding it with an
ampersand (&). If you check No Character Underline, underlining is disabled
and ampersands are displayed as literal characters.
Border Whether the control has a border.

Setting the unique properties of a control


In addition to the common properties described in the previous two sections, each
standard control has unique properties that you can set in the Style window. The unique
properties of each control are described in the following sections.

Chapter 10, Working with dialog boxes 161


Push button properties
The push button control has unique properties for type and control ID.

Type property
You can set the Type property to one of the following values:

Value Description
Push Button A normal push button.
Default Push Button Identical to a push button, but also includes a bold border indicating that it’s the
default response if the user presses Enter.
Bitmap Button A button that contains a bitmap (available only for Borland push button controls).

If you choose the Bitmap option, you can insert a bitmap image (based on its control ID)
into the button. To read in a bitmap,
1 Add a Borland push button control to a dialog box. Note its control ID.
2 Create a bitmap. (For information about creating bitmaps, see Chapter 13, “Working
with graphics,” on page 187.)
3 Choose Resource|Rename.
4 In the New Name box, type an integer value that equals the current control ID of the
button plus the appropriate offset from the following table:

If the bitmap represents Use this offset for VGA Use this offset for EGA and
the button in this state and higher resolutions monochrome resolutions
Standard 1000 2000
Pressed 3000 4000
Keyboard focus 5000 6000

For example, for a bitmap that represents the button in its focused state, use the
control ID of the button plus 5000 for a VGA system and 6000 for an EGA system.
5 Choose OK.
6 Close the Graphic editor.
The bitmap won’t appear in the control until you close the Graphic editor.
7 Switch to the Dialog editor.

Control ID property
Just as with the other controls, you can set the Control ID property of a push button to
any integer value. However, the following values have predefined meanings:

Control ID Value Meaning


IDOK 1 OK
IDCANCEL 2 Cancel
IDABORT 3 Abort

162 User’s Guide


Control ID Value Meaning
IDRETRY 4 Retry
IDIGNORE 5 Ignore
IDYES 6 Yes
IDNO 7 No

Note If you’re using the Borland push button control, the appropriate caption is set
automatically when you specify a predefined control ID.

Radio button properties


The radio button control has a unique Type property that you can set to Normal or
Auto. If you set the type to Auto, Windows automatically selects or unselects the button;
your application doesn’t have to do the painting.

Check box properties


The check box control has a unique Type property that you can set to one of the
following values:

Value Description
Normal A normal check box. Your application is responsible for checking or unchecking the box.
Auto A normal check box that Windows automatically checks or unchecks.
3 State A check box with three states: checked, unchecked, and dimmed. Your application is
responsible for activating each state.
Auto 3 State A 3 state check box that Windows automatically checks, unchecks, or dims.

Static text properties


The static text control has a unique Type property. You can set the Type property to one
of the following values:

Value Description
Left Text Displays text flush left within the control border (default). If text would extend
past the edge of the frame, it automatically wraps to a new line.
Left Text—No Wrap Displays text flush left within the control border. Any line of text that extends past
the edge of the frame is clipped.
Centered Text Displays text centered within the control border. If text would extend past the
edge of the frame, it automatically wraps to a new line.
Right Text Displays text flush right within the control border. If text would extend past the
edge of the frame, it automatically wraps to a new line.
Simple Text Displays a single line of flush-left text. Doesn’t take tab characters and can’t be
broken to a new line. Simple text doesn’t process the WM_CTLCOLOR message.
Uses the current window background color.

Note The text in all these styles uses the current Windows text color from the Control Panel.
Also, in all static text but simple text, you can tab text by typing \T, and you can break text
to a new line with \R.

Chapter 10, Working with dialog boxes 163


Group box properties
The Borland group box control has a unique Type property that you can set to Normal
(group) Shade or Raised Shade. If you set the Type property to Normal Shade, the
surface of the group box appears to go inward; otherwise, the surface of the group box
appears to go outward.

Scroll bar properties


The scroll bar control has a unique Alignment property that you can set to any of the
following values:

Option Description
None The scroll bar fills the entire selection frame (default). If you resize the selection frame,
you can change the scroll bar’s proportions, making the arrow buttons and scroll box
wider than usual.
Top Left A horizontal scroll bar displays at the top of the selection frame and extends the full
width of the frame. A vertical scroll bar displays at the left side of the selection frame
and extends the full height of the frame.
Bottom Right A horizontal scroll bar displays at the bottom of the selection frame and extends the full
width of the frame. A vertical scroll bar displays at the right side of the selection frame
and extends the full height of the frame.

Edit box properties


The edit box control has several unique properties, which are described in the following
sections.

Case property
You can set the Case property to one of the following values:

Value Description
Case Insensitive Displays text exactly as typed (default).
Upper Case Displays all text in uppercase letters, regardless of how it’s typed.
Lower Case Displays all text in lowercase letters, regardless of how it’s typed.

Windows 3.1 Style property


You can set the Windows 3.1 Style property to one of the following values:.

Value Description
Read Only The text is set to read-only. The windows.h constant for this style is ES_READONLY.
Want Return The Return key forces a line break in a multiline edit text control that has keyboard
focus. If the control doesn’t have keyboard focus, the carriage return goes to the
default push button. If the control doesn’t have this flag, the user must press
Ctrl+Return to create a line break. The windows.h constant for this style is
ES_WANTRETURN.

164 User’s Guide


Line property
You can set the Line property to one of the following values:

Value Description
Single Line Limits the edit text to a single line (default).
Multiple Line Lets the user type text on multiple lines. (To enable scrolling of multiple-line text, set
the Vertical Automatic Scroll option to on.)

Miscellaneous Boolean properties


You can turn the following properties on or off:

Property Description
Automatic Horizontal Scroll When the user types a character at the right edge of the edit text
boundary, the text automatically scrolls ten characters to the right. When
the user presses Enter, the text scrolls back to the zero position.
Automatic Vertical Scroll When the user presses Enter on the last line of the edit text control, the text
scrolls up a full page. For example, if the control is five lines long,
pressing Enter on the last line causes text to scroll up five lines; the cursor
goes back to the top line.
Password When Password is on, the letters being typed are not displayed. Instead,
asterisks appear in their place. This is helpful for keeping passwords
secret.
Convert OEM Converts text typed into the control to the current OEM character set,
then reconverts the text to ANSI. This option is useful in file input boxes
because it ensures that any file name entered can be translated into the
OEM character set, which is used by the DOS file system.
Keep Selection Keeps selected text highlighted, even when this control doesn’t have
keyboard focus. For example, if a user highlights text in an edit text
control and then moves to another control, the text will no longer be
highlighted, unless the edit text control has the Keep Selection property
turned on.

List box properties


The list box control has the following unique properties, which you can turn on or off:

Property Description
Notify Sends an input message to the parent window when the user clicks an item in
the list (default).
Sort Sorts the list alphabetically.
Multiple Select Lets the user select more than one item at a time. The user can also toggle
individual items on and off.
Don’t Redraw Prevents the list box from being redrawn when it is changed.
Tab Stops Organizes the information in the list box in columns. The default column
width is 32 dialog units or 8 characters. You should use tab characters. (If you
want to change the column width, the application should set its own tab stops
using the LB_SETTABSTOPS message.)
Integral Height Decreases list box height at run time, if necessary, to the nearest integral
multiple of the current font height (default) For example, a list box might have
three items that display completely, but a fourth that is partially cut off. If
Integral Height is turned on, the list box decreases its size at run time to the
space required for three items (three times the font height).

Chapter 10, Working with dialog boxes 165


Property Description
Multi Column Creates a list box in which the text wraps from column to column. The user
scrolls the list box horizontally to display additional text. If you turn this option
on, the application must send the LB_SETCOLUMNWIDTH message to set
the width of all columns in pixels.
Pass Keyboard Input Passes what the user types to the application.
Extend Select (used with Lets the user select more than one item in a list.
multiple-select boxes)
Has Strings Specifies list box contents. If you’ve chosen either the Fixed or Variable Owner
Drawing option, the list box stores text for each list item with the
LB_INSERTSTRING or LB_ADDSTRING message. The list box can also
retrieve list items from the message LB_GETTEXT.
Scroll Bar Always Specifies list box attributes. The list box always displays a vertical scroll bar,
(Windows 3.1 only) regardless of the number of items it contains. The windows.h constant for this
style is LBS_DISABLENOSCROLL.

Combo box properties


The combo box control has several unique properties, which are described in the
following sections.

Type property
You can set the Type property to one of the following values:

Value Description
Simple The drop-down list is always expanded to display items in the list, and the user
can edit the items in the list (default).
Drop Down When the dialog box is first displayed, the combo box consists of a single line
of editable text. The user can click the down arrow to expand the list, and edit
all items in the list.
Drop Down List This option works like a drop down, but the list is static. The user can select,
but can’t change anything in the list.

Miscellaneous Boolean properties


You can turn the following properties on or off:

Property Description
Sort Automatically sorts items in a list box in alphabetical order.
Integral Height Sizes the list box at run time so all items in the list are completely displayed
(default). If you want to control the height of the list box precisely, uncheck this
option.
OEM Conversion Converts text the user types in to the current OEM character set, then
reconverts the text to ANSI. This option is useful in file input boxes because it
ensures that any file name entered can be translated into the OEM character
set, which is used by the DOS file system.
Auto Horizontal Scrolls text to the left automatically when it exceeds the width of the control.
Vertical Scroll Always The combo box always displays a vertical scroll bar, regardless of the number
of items it contains. The windows.h constant for this style is
CBS_DISABLENOSCROLL. This property applies to Window 3.1 resources
only.

166 User’s Guide


Icon properties
To place an iconic static control in your dialog box,
1 In the Tools palette, click the Icon tool.
2 In the dialog box template, drag where you want the icon to appear.
The icon control appears in the dialog box template.
3 Double-click the icon control.
4 In the Caption box, type the identifier for an icon resource. For information about
creating an icon resource, see Chapter 13, “Working with graphics,” on page 187.
5 Select the Number option.
6 Choose OK.
The icon appears in your dialog box.

Frame properties
The frame control has a unique Type property, which you can set to any of the following
values:

Value Description
White Frame Displays an empty frame with a solid outline that uses the current Windows
background color set in the Control Panel. In Windows, the default color for the
background is white.
Gray Frame Displays an empty frame with a solid outline that uses the current screen
background (Desktop) color set in the Control Panel. In Windows, the default color
for the Desktop is gray.
Black Frame Displays an empty frame with a solid outline that uses the current Windows frame
color set in the Control Panel. The Windows default color for window frames is
black.

Rectangle properties
The rectangle control has a unique Type property, which you can set to any of the
following values:

Value Description
White Rectangle Displays a filled rectangle that uses the current Windows background color set in
the Control Panel. In Windows, the default color for the background is white.
Gray Rectangle Displays a filled rectangle that uses the current screen background (Desktop) color
set in the Control Panel. In Window, the default color for the Desktop is gray.
Black Rectangle Displays a filled rectangle that uses the current Windows frame color set in the
Control Panel. In Windows, the default color for window frames is black.

Line properties
The line control has a unique Type property, which you can set to any of the following
values:

Chapter 10, Working with dialog boxes 167


• Horizontal dip
• Vertical dip
• Horizontal bump
• Vertical bump
A dip appears to be etched into the surface of the dialog box; a bump appears to be
raised above the surface of the dialog box.

Testing a dialog box resource


To see the effect of any changes you’ve made to the dialog box resource, select the Test
tool or choose Options|Test Dialog.
Test tool You can press Tab and the arrow keys to see how you can move around your dialog box,
or you can type text to see how text is scrolled in an edit text control. Check to see if your
controls are in the order you want them.
When you test a dialog box, the status line at the bottom of the Dialog editor says Test.

Testing two dialog boxes at the same time


To test two dialog boxes at the same time,
1 In the Project window, double-click the name of the first dialog box. The Dialog
editor starts and displays that dialog box.
2 Click the Test tool or choose Options|Test Dialog.
3 Click the Minimize button of the Dialog editor twice. (The first click switches focus
from the dialog box to the Dialog editor window.) Your dialog box is now floating
and modeless; you can move it like any other window.
4 Return to the Project window and double-click the name of the second dialog box
you want to view. A second Dialog editor starts up.
5 Again, click the Test tool or choose Options|Test Dialog in the second Dialog editor.
6 Click the Minimize button of the second Dialog editor twice.
Now you have two floating dialog boxes that you can test at the same time.

Returning to Edit mode


To leave test mode and return to edit mode, do one of the following:
• In the dialog box, choose OK or Cancel.
• Choose Options|Test Dialog again.
• Press Enter.
• Click the Selector twice. (The first click switches focus from the dialog box to the
Dialog editor.)

168 User’s Guide


Customizing the Dialog editor
You can customize the Dialog editor by choosing Options|Preferences and specifying
any of the following options:

Option Settings and Descriptions


StatusLine Units Determines the unit of measurement the status line uses to display information:
Dialog. Uses the dialog unit as the unit of measurement on the status line. In a dialog
unit, y equals 1/8 of the font height, and x equals 1/4 of the font width.
Screen. Uses pixels as the unit of measurement on the status line.
Selection Border Lets you change the appearance of the frame that surrounds selected controls:
Thick frame. The selection frame is thick, like the standard frame around a Windows
application or dialog box window (default).
Handles. The selection frame is a rectangular outline with handles (small squares) at
each corner and at the midpoint of each side.
Drawing Type Determines how elements of your dialog box are displayed in the Dialog editor:
Draft. Draws each control as a rectangle with its control ID in the center. This option
also lets you see how much space is occupied by the control’s selection frame.
Normal. Draws standard Windows controls as they will appear at run time. Drawing
of custom controls is determined by the Draw Custom Controls as Frames check box,
described shortly.
WYSIWYG (the default option). With this option selected, Resource Workshop creates
the dialog and control child windows and the controls draw themselves. This option is
slowest, but the most accurate. Installable custom controls draw themselves.
Selection Rules Determines how controls are selected. If you’re working with closely spaced controls,
use these options for greater precision and to avoid selecting controls inadvertently:
Select Near Border. If this option is checked, you must click on the control’s border. If it
is not checked, you can click anywhere inside the control’s border.
Selection Rectangle Surrounds. If this option is checked, you must entirely surround the
control (or controls) with the selection rectangle. If it is not checked, the selection
rectangle need only touch the control (or controls).

In the resource script language, each type of control has a unique syntax. For example,
centered static text uses the CTEXT statement. The CONTROL statement, however, can
specify any type of control. If you want to generate only CONTROL statements in your
resource script (rather than the specialized control statements), select the Generate
CONTROL Statements Only option. For more information about the resource script
language, search Help for “Editing a Resource as Text.”
The Draw Custom Controls as Frames check box is available only when the Drawing
Type is set to Normal. When the option is checked, custom controls are drawn as empty
rectangular outlines. When the option is unchecked, custom controls are drawn as gray
rectangles with their text (if any) in a white rectangle in the center. Drawing custom
controls as frames can speed up drawing of your dialog boxes on the screen.
If you check CTL3D2V.DLL, the Dialog editor uses the Windows 3-D look for controls
such as radio buttons and check boxes.

Chapter 10, Working with dialog boxes 169


Using a dialog box resource in an application
You can program a dialog box with OWL or the Windows API.

Programming a dialog box with OWL


To program a dialog box with OWL, use the TDialog class. For example, the following
code shows how to create and display a modal dialog box.
TDialog dialog1(GetApplication()->GetMainWindow(), IDD_DIALOG1);
dialog1.Execute();
In the preceding code, dialog1 is the name of the dialog box class, and
IDD_IDENTIFIER1 is the identifier for the dialog box resource.
For more information about programming dialog boxes with OWL, see the
ObjectWindows Programmer’s Guide.

Programming a dialog box with the Windows API


To program a dialog box with the Windows API, use the DialogBox function. For
example, the following code shows how to create and display a dialog box.
HINSTANCE hInst;
HWND hwndParent;
DLGPROC dlgProc;
dlgProc = (DLGPROC) MakeProcInstance(ResModeDlgProc, hInst);
DialogBox(hInst, MAKEINTRESOURCE(IDD_RESDEMODIALOG), hwndParent, dlgProc);
FreeProcInstance((FARPROC) dlgProc);
For more information about programming dialog boxes with the Windows API, search
the Windows 3.1 SDK Help file (WIN31WH.HLP) for “Dialog Boxes.”

170 User’s Guide


Chapter

Working with menus and


Chapter 11
11
accelerator tables
A menu is a list of actions that a user can perform. The types of menus you can add to an
application include standard menus, which appear on an application’s menu bar;
floating menus, which can appear anywhere on the screen; and hierarchical (cascading)
menus, which appear when you choose a menu item. Applications often have standard
menus that are labeled File, Edit, and Help; these menus contain file manipulation,
editing, and online Help commands, respectively.
An accelerator table contains one or more combination of keys that a user can press to
perform an action. For example, many applications use Ctrl+X to cut data and Ctrl+V to
paste data.
Like other resources, you define a menu or accelerator with a resource script. This
chapter shows how to edit a resource script for a menu or accelerator table, assign an
accelerator to a menu item, and use the corresponding resources in an application. This
chapter also shows how to customize the Menu and Accelerator editors.

Editing a menu resource script


You edit menu resources by using the Menu editor.
To start the Menu editor,
1 Add a new menu resource script to a resource script file. Or open a resource script file
that contains a menu resource script.
2 If the Menu editor doesn’t start automatically, double-click a menu in the Project
window.
The Menu editor appears. It contains three panes:
• The Attribute pane is where you edit existing menus and menu commands.

Chapter 11, Working with menus and accelerator tables 171


• The Test pane displays your menu and lets you test it.
• The Outline pane shows the menus, menu items, and separators in pseudocode. To
see the complete code with all parameters for each statement, edit the resource script
file with a text editor. For more information, search online Help for “Editing a
Resource as Text.”

Test pane

Attribute pane

Outline pane

After you start the Menu editor, you can edit the menu resource script by
• Adding a menu or separator to the menu bar
• Adding a menu item or separator to a menu
• Setting the initial state of a menu or menu item
• Changing the identifier for a menu item
• Associating Help text with a menu item
• Assigning an accelerator to a menu item
• Copying, moving, or removing a menu, menu item, or separator
• Checking for duplicate identifiers
To customize the Menu editor, see “Customizing the Menu editor” on page 178.

Adding a menu or separator to the menu bar


You can add a predefined menu, custom menu, or separator to the menu bar. With a
separator, you can place menus to the far right or on different lines of the menu bar.

Adding a predefined menu


To add a predefined menu to the menu bar,

172 User’s Guide


1 In the Outline pane, select a line between the POPUP and End Popup lines of a menu;
this menu will immediately follow the predefined menu. (You can’t add a predefined
menu as a cascading menu.)
2 Choose one of the following commands:

Command Description
Menu|New File Adds a File menu that contains the following commands: New, Open, Save, Save
As, Print, Page Setup, Printer Setup, and Exit.
Menu|New Edit Adds an Edit menu that contains the following commands: Undo, Cut, Copy and
Paste.
Menu|New Help Adds a Help menu that contains the following commands: Index, Keyboard,
Commands, Procedures, Using Help, and About.

Adding a custom menu


To add a custom menu to the menu bar,
1 In the Outline pane, select the line that will immediately precede the menu. If you
select a line inside an existing menu (between the POPUP and End Popup lines), the
new menu becomes a cascading menu.
2 Choose Menu|New Popup. Or press Ctrl+P.
3 In the Attributes pane, type the menu name in the Item text box.
To associate the menu with a shortcut key, include an ampersand (&) in the menu
name. The letter following the ampersand will be underlined, and the user will be
able to select the menu by pressing Alt plus the underlined letter. If you want an
ampersand character to appear in the menu name, use two ampersands (&&).
You can also use the tab character (\t) and the right-align character (\a) in the menu
name.
Now you can test your menu in the Test pane.

Adding a separator
To add a separator to the menu bar,
1 In the Outline pane, select the POPUP line of a menu; this menu that will
immediately follow the separator.
2 In the Attributes pane, choose one of the following options:

Option Description
Menu Bar Break or Menu Break Starts a new line in the menu bar.
Help Break Moves the menu to the far right of the menu bar.

Adding a menu item or separator to a menu


To add a menu item to a menu,

Chapter 11, Working with menus and accelerator tables 173


1 In the Outline pane, select the menu item that will immediately precede the new
menu item.
2 Choose Menu|New Menu Item. Or press Ins.
The new menu item appears.
3 In the Attributes pane, type the name of the new menu item in the Item box.
To associate the menu item with a shortcut key, include an ampersand (&) in the menu
item name. The letter following the ampersand will be underlined, and the user will be
able to select the menu item by pressing Alt plus the underlined letter. If you want an
ampersand character to appear in the menu item name, use two ampersands (&&).
You can also use the tab character (\t) and the right-align character (\a) in the menu
item name.
To add a vertical separator to a menu,
1 In the Outline pane, select the menu item that will immediately follow the separator.
2 In the Attributes pane, choose one of the following options:

Option Description
Menu Bar Break Starts a new column that is preceded by a vertical line in the menu.
Menu Break Starts a new column in the menu.

To add a horizontal separator to a menu,


1 Select the menu item that will immediately follow the separator.
2 Choose Menu|New Menu Item. Or press Ins.
3 In the Attributes pane, choose Separator in the Item Type group.

Setting the initial state of a menu or menu item


To set the initial state of a menu or menu item,
1 In the Outline pane, select the menu or menu item.
2 In the Attributes pane, choose one of the following options:

Option Description
Enabled In its initial state, the menu or menu item is enabled. Use the EnableMenuItem function
to change the state of the menu or menu item in code.
Disabled In its initial state, the menu or menu item is disabled. The user can’t distinguish
between Enabled and Disabled commands; they look the same on the menu. Use the
EnableMenuItem function to change the state of the menu item.
Grayed In its initial state, the menu or menu item is disabled and its text is grayed. The shading
lets the user know the command is not currently available. Use the EnableMenuItem
function to change the state of the menu or menu item.

3 In the Attributes pane, select or unselect the Checked box. If you select the Checked
box, a check mark appears next to the menu item. You can use a checkmark to

174 User’s Guide


represent an option that can be turned on or off. You can check or uncheck the menu
item in code with the CheckMenuItem function.

Changing the identifier for a menu item


An identifier is automatically assigned to each menu item that you create. You can
change the identifier for the current menu item by typing a name or value in the Item ID
box, or by using the Resource|Identifiers command. For more information about
creating and editing identifiers, see “Creating a resource script file” on page 136.

Associating Help text with a menu item


You might want to associate Help text with a menu item so that you can easily display
information about the menu item in the status bar of an application.
To associate Help text with a menu item,
1 In the Outline pane, select the menu item.
2 In the Attributes box, type the text into the Item Help box.
The Help text is automatically added to a string table in the current resource script file.
(If one doesn’t already exist, a string table is automatically added to the current resource
script file.)

Assigning an accelerator to a menu item


You can assign an accelerator to a menu item in Key Value or Manual mode.
In Key Value mode, any key or key combination you press is automatically assigned to
the menu item. You don’t have to manually type the key name, select a key type (ASCII
or virtual), or select combination keys (Alt, Shift, and Ctrl).
In Manual mode, you provide all the information that defines the accelerator. You must
decide whether to use an ASCII or virtual key. (In general, an ASCII key is an
alphanumeric character or punctuation mark, and a virtual key is a function key, arrow
key, or an editing key, such as Home or PgDn.) If it’s a virtual key, you must type the
correct identifier for the key as it is defined in the windows.h file. You must also select
the appropriate Key Type radio button (ASCII or Virtual Key) and select the appropriate
combination of the Alt, Shift, and Ctrl check boxes.
To assign an accelerator to a menu item in Key Value mode,
1 In the Outline pane, select the menu item.
2 Choose Menu|Accelerator Key Value.
3 Press the keyboard combination for the accelerator.
4 Press Esc.
5 Select the Invert option if you want the corresponding menu to flash when the user
presses the accelerator key.

Chapter 11, Working with menus and accelerator tables 175


To assign an accelerator to a menu item in Manual mode,
1 In the Outline pane, select the menu item.
2 In the Key box in the Attributes pane, specify an ASCII or virtual key.
To specify an ASCII key, type the key in quotation marks. Typically you don’t use a
single ASCII character as an accelerator key; instead you combine the character with
the Alt or Ctrl keys. To add the Ctrl key, precede the ASCII key with a caret (^). For
example, type "^P" to assign Ctrl+P to the menu item. To add the Alt key, select the Alt
option in step 4.
To specify a virtual key, type the identifier for the key in uppercase letters. The
identifiers for virtual keys all start with VK_ and are defined in the windows.h file.
You can combine the virtual key with the Alt, Shift, and Ctrl keys in step 4.
3 In the Key type group, choose ASCII or Virtual Key, depending on the key you
specified in step 2.
4 Select any of the following options:

Option Description
Alt Combines the Alt key with the accelerator key (for example, Alt+W).
Shift Combines the Shift key with the accelerator key (for example, Shift+F1). You can’t use the
Shift option with an ASCII key.
Control Combines the Ctrl key with the accelerator key (for example, Ctrl+W). You can’t use the
Control option with an ASCII key. However, you can combine the Ctrl key with an
ASCII key by including a caret (^) in the key name. (See step 2.)
Insert Causes the corresponding menu to flash when the user presses the accelerator key
combination.

The accelerator is automatically added to an accelerator table in the current resource


script file. For more information about accelerator tables, see the section “Customizing
the Menu editor” on page 178.

Copying, moving, or removing a menu, menu item, or separator


You can use the commands on the Edit menu to copy, move, or remove the current
menu, menu item, or horizontal separator.
Note You can’t remove the last menu, menu item, or horizontal separator from a menu.
However, you can remove the menu resource script by selecting the script in the Project
window and pressing Del.
You can’t copy or move a vertical separator, but you can remove it.
To remove a vertical separator,
1 In the Outline pane, select the menu or menu item that follows the separator.
2 In the Attributes pane, choose No break.

176 User’s Guide


Checking for duplicate identifiers
To check for duplicate identifiers, choose Menu|Check Duplicates.
If two menu items have the same identifier, the message “Duplicate command value
found” appears, and the second menu item with a duplicate identifier appears in the
Attributes pane.

Creating a resource script for a floating menu


A floating menu can be displayed anywhere on the screen; it is not tied to a menu bar.
To create a resource script for a floating menu,
1 Using the File|Add To Project command, add a menu resource indirectly to the
current resource script file. For more information, see “Adding a new resource script
indirectly” on page 137.
2 In the Outline pane, select the name of the resource. (The name is centered on the first
line.)
3 Press the Ins key to add at least one menu item at the top of the outline.
4 Remove the default menu.
5 Add, edit, or remove menu items. These procedures are described in the previous
sections.
6 Using the Resource|Save resource as command, save the menu resource script in a
new resource script file.
Note To see how the resource will appear at run time, choose View|View As Popup. When
you view the menu in the Test Menu pane, it will still appear tied to the menu bar, but
as long as your code uses the TrackPopupMenu function correctly, the menu will float at
run time.

Chapter 11, Working with menus and accelerator tables 177


Customizing the Menu editor
You can use the following commands to customize the menu editor:

Option Description
View|View As Popup Select this option to have menus displayed as cascading menus in a
single main menu; deselect this option to have menus displayed on the
menu bar.
Leave View As Pop-up unchecked if your menu resource contains the
application’s entire menu structure and you want it displayed as it
would appear to the user.
If you’re working on a floating menu, check this option to display the
test menu as it actually would appear. The command Pop-up appears on
the menu bar, and you select Pop-up to display the menu itself.
View|First Graphic This graphic represents the default configuration of the panes, with the
Test Menu pane over the Outline pane and to the right of the Attribute
pane.
View|Second Graphic Check this graphic to put the Test Menu pane across the top of the edit
window, like a normal menu bar.
Menu|Change Identifier Prefix Use this command to change the identifier prefix that is automatically
assigned to new menu items.
Menu|Track Test Menu Select this option if you want menu items to appear in the Attributes
pane when you select them in the Test pane.

Editing an accelerator table resource script


You can create accelerators for menu items using the Menu or Accelerator editors.
However, you must use the Accelerator editor to remove accelerators and to create
accelerators that are not linked to menu items.
To start the Accelerator editor,
1 Add a new resource script for an accelerator table to a resource script file. Or open a
resource script file that contains a resource script for an accelerator table.
2 If the Accelerator editor doesn’t start automatically, double-click an accelerator table
in the Project window.
The Accelerator editor appears. It contains two panes:
• The Attribute pane is where you edit existing accelerators.
• The Outline pane shows you, in outline script form, all the accelerators defined in the
table. The top line of this outline is the name of the accelerator table. The lines below

178 User’s Guide


it are accelerator entries, which have three parts: the keyboard combination, the
identifier for the accelerator, and virtual or ASCII indicator.

Outline pane

Attribute pane

After you start the Accelerator editor, you can edit the resource script for the accelerator
table by
• Adding an accelerator resource
• Changing the identifier for an accelerator resource
• Changing the keyboard combination for an accelerator resource
• Copying, moving, or removing an accelerator resource
• Checking for duplicate keyboard combinations

Adding an accelerator resource


To add an accelerator resource to the accelerator table,
1 In the Outline pane, select the accelerator resource that will immediately precede the
new accelerator resource.
2 Choose Accelerator|New Item. Or press Ins.
When you add an accelerator resource, the editing focus automatically switches to the
Attribute pane.

Changing the identifier for an accelerator resource


An identifier is automatically assigned to each accelerator resource that you create. In
the Attributes pane, you can change the identifier for the current accelerator resource by
typing a name or value in the Command box, or by using the Resource|Identifiers

Chapter 11, Working with menus and accelerator tables 179


command. For more information about creating and editing identifiers, see “Working
with resource script files” on page 135.
If you type the identifier for a menu item in the Command box, the accelerator is
assigned to the menu item.

Changing the keyboard combination for an accelerator resource


You can change the keyboard combination for an accelerator resource in Key Value or
Manual mode. These modes are described in the “Assigning an accelerator to a menu
item” on page 175.
To change a keyboard combination for an accelerator resource in Key Value mode,
1 In the Outline pane, select the accelerator resource. You can use the mouse or
keyboard (Ctrl ↑ or Ctrl ↓).
2 Choose Accelerator|Key Value.
3 Press the new keyboard combination for the accelerator.
4 Select the Invert option if you want the corresponding menu to flash when the user
presses the accelerator key. If the accelerator key is not assigned to a menu item, then
the Invert option is ignored.
To change the keyboard combination for an accelerator resource in Manual mode,
1 In the Outline pane, select the accelerator resource. You can use the mouse or
keyboard (Ctrl ↑ or Ctrl ↓).
2 In the Command box in the Attributes pane, type an ASCII or virtual key.
For more information about ASCII and virtual keys, see the section “Assigning an
accelerator to a menu item” on page 175.
3 In the Key type group, choose ASCII or Virtual Key, depending on the key you
specified in step 2.
4 In the Modifiers group, select or deselect the Alt, Shift, Control, and Invert options.
For more information about these options, see the section “Assigning an accelerator
to a menu item” on page 175.

Copying, moving, or removing an accelerator resource


You can use the commands on the Edit menu to copy, move, or remove the current
accelerator resource.
Note You can’t remove the last accelerator resource from an accelerator table. However, you
can remove the resource script for the accelerator table by selecting the script in the
Project window and pressing Del.

180 User’s Guide


Checking for duplicate keyboard combinations
To check for duplicate keyboard combinations, choose Accelerator|Check Dup Keys.
If two accelerator resources use the same keyboard combination, the message
“Duplicate key value found” appears, and the second of the accelerator resources with
duplicate keyboard combinations is highlighted in the Outline pane.

Customizing the Accelerator editor


You can customize the Accelerator editor by changing the identifier prefix that is
automatically assigned to new accelerators.
To change the identifier prefix that is automatically assigned to new accelerators,
1 Choose Accelerator|Change Identifier Prefix.
2 Type the new identifier prefix.
3 Choose OK.

Using menu and accelerator resources in an application


You can program menus and accelerators with OWL or the Windows API.

Programming menus and accelerators with OWL


To program menus and accelerators with OWL, use the TMenu class and the
LoadAccelerators function. For example, the following code shows how to associate a
menu and accelerators with the main window.
GetMainWindow()->AssignMenu(IDM_MENU1);
LoadAccelerators(IDD_ACCELERATORS1);
In the above code, IDM_MENU1 and IDD_ACCELERATORS1 are the identifiers for the
menu and accelerator table respectively.
For more information about programming menus and accelerators with OWL, see the
ObjectWindows Programmer’s Guide.

Programming menus and accelerators with the Windows API


To program menus and accelerators with the Windows API, use the LoadMenu and
LoadAccelerators functions. For example, the following code shows how to associate a
menu and accelerators with the main window.
HMENU hMenu;
hMenu = LoadMenu(hInst, MAKEINTRESOURCE(IDD_MENU1)
LoadAccelerators(hInst, MAKEINTRESOURCE(IDD(ACCELERATORS1)
In the preceding code, IDM_MENU1 and IDD_ACCELERATORS1 are the identifiers
for the menu and accelerator table respectively.

Chapter 11, Working with menus and accelerator tables 181


For more information about menus and accelerators with the Windows API, search the
Windows 3.1 SDK Help file (WIN31WH.HLP) for “Menu Functions” and “Accelerator
Resource.”

182 User’s Guide


Chapter

Working with string tables


Chapter 12
12
A string table contains descriptions, prompts, error messages, and other text that your
application displays.
Like other resources, you define a string table with a resource script. This chapter shows
how to edit a string table resource script, and use the corresponding resource in an
application. This chapter also shows how to customize the String editor.

Editing a string table resource script


You edit a string table resource script by using the String editor.
To start the String editor,
1 Add a new string table resource script to a resource script file. Or open a resource
script file that contains a string table resource script.
2 If the String editor doesn’t start automatically, double-click a string table in the
Project window.
The String editor appears. It is similar to a three-column spreadsheet.
After you start the String editor, you can edit the string resource script by
• Adding a string resource
• Changing the characters of a string resource
• Changing the identifier for a string resource
• Copying, moving, or removing a string resource
To customize the String editor, see “Customizing the String editor” on page 185.

Adding a string resource


To add a string resource,

Chapter 12, Working with string tables 183


1 Select the line containing the string resource that will immediately precede the new
string resource.
2 Choose String Table|New Item. Or press Ins.
3 In the String column, type up to 255 characters. You can also use any of the C-type
escape sequences, including \n (newline), \t (tab), \r (carriage return),
\\ (backslash), and \” (double quote).
4 Press Enter.

Changing the characters of a string resource


To change the characters of a string resource,
1 In the String column, select the characters.
2 Type the new characters. You can also use any of the C-type escape sequences,
including \n (newline), \t (tab), \r (carriage return), \\ (backslash), and \” (double
quote).
3 Press Enter.

Changing the identifier for a string resource


To change the identifier for a string resource,
1 In the Source ID column, select the identifier.
2 Type a new identifier.
3 Press Enter.
Note You can’t directly change the identifier in the ID Value column; however, any integer
that you type into the Source ID column is automatically copied into the ID Value
column.
You can also change the identifier for a string resource by using the Resource|
Identifiers command. For more information about identifiers, see “Working with
resource script files” on page 135.

Grouping string resources to maximize memory efficiency


String resources are linked to an application in 16-resource segments. String resources
with identifier values from 0 to 15 are in the first segment, string resources with
identifier values from 16 to 31 are in the second segment, and so on.
When an application uses a string resource, it loads all the string resources in the
corresponding segment. Therefore, you can maximize the memory efficiency of an
application by grouping related string resources together.
For example, suppose you’ve created six string resources for the title screen of an
application. If you arrange these string resources into six different segments, the
application could load over 24000 bytes of unused string resources, depending on the
sizes of the string resources in each segment, when the title screen is displayed. On the

184 User’s Guide


other hand, if you group the six string resources into one segment, the application will
load no more than 4100 bytes of string resources when the title screen is displayed.

Copying, moving, or removing a string resource


You can use the commands on the Edit menu to copy, move, or remove a string
resource. You can also perform these actions with the shortcut menu. To display the
shortcut menu, right-click on a string resource.
Note You remove all but the last string from a string table. You can remove the string table
resource script by selecting it in the Project window and pressing Del.

Customizing the String editor


You can customize the String editor by changing the identifier prefix that is
automatically assigned to new string resources.
To change the identifier prefix that is automatically assigned to new string resources,
1 Choose String Table|Change Identifier Prefix.
2 Type the new identifier prefix.
3 Choose OK.

Using a string resource in an application


To include a string resource in an application, use the LoadString function. For example,
the following code shows how to copy a string resource into a variable.
char messageText[255];
LoadString(IDS_STRING1, messageText, sizeof(messageText));
In the above code, IDS_STRING1 is the identifier for the string.
For more information about using strings in an applications, search the Windows 3.1
SDK Help file (win31wh.hlp) for “String-Manipulation Functions.”

Chapter 12, Working with string tables 185


186 User’s Guide
Chapter

13
Working with graphics
Chapter 13

With Resource Workshop, you can create and edit the following types of graphics:
• A bitmap, which is a graphic image, such as a picture, logo, or other drawing.
• An icon, which is a graphic image that represents a minimized window. An icon is
64x64, 32x32, 16x32, or 16x16 pixels in size.
• A cursor, which is a graphic image that shows the position of the mouse on the screen
and indicates the types of actions that a user can perform. A cursor is 32x32 pixels in
size. Many applications use a pointer, which indicates that the user can make a
selection, and an hourglass, which indicates that the system is performing an action.
• A font, which is a set of characters with a specific typeface and size. For example,
10-point Times Roman bold is a font. A font can also contain a set of bitmaps that
aren’t characters.
Like other resources, you define a graphic with a resource script. This chapter describes
how to edit a resource script for a graphic, and use the corresponding resource in an
application.

Editing a resource script for a graphic


You edit a resource script for a graphic by using the Graphic editor.
To start the Graphic editor,
1 Add a new resource script for a graphic to a resource script file.
Or open a resource script file that contains a resource script for a graphic.
Or create or open a graphic file.
2 If the Graphic editor doesn’t start automatically, double-click a graphic in the Project
window.

Chapter 13, Working with graphics 187


3 If you’re editing a resource script for an icon or cursor that contains more than one
image, double-click an image in the Image window. (The Image window has the
identifier for the icon or cursor in its caption.)
The Graphic editor appears. It contains a Tools palette and Colors palette.

First pane Colors palette


Drawing Area
Tools palette
Second pane

Drawing Area

The Tools palette contains the drawing tools.

Pick Rectangle Scissors

Zoom Eraser

Pen Paintbrush

Airbrush Paint Can

Line Text

Empty Rectangle Filled Rectangle

Empty Rounded Rectangle Filled Rounded Rectangle

Empty Ellipse Filled Ellipse

Paintbrush Shape Airbrush Shape

Pen Style Pattern

The Colors palette shows the available colors.


To customize the Graphic editor, see “Customizing the Graphic editor” on page 199.

188 User’s Guide


Choosing colors
You can draw or paint with up to 256 different colors, which you can choose from a
palette of over 16 million colors. However, the maximum number of colors that you can
use at a given time depends on the type of graphic that you’re editing and the
capabilities of your display device and driver. For example, if you’re editing a cursor or
font, you can use black and white only. And if you’re editing a bitmap or icon, the
maximum number of colors you can use is specified in the Colors property of the
bitmap or icon. For information about changing the Colors property of a bitmap or icon,
see the sections “Changing the properties of a bitmap” on page 196 and “Changing the
properties of an icon” on page 197.
To view the capabilities of your display device and driver,
1 Edit a bitmap or icon.
2 Choose Bitmap|Size And Attributes or Icon|Size And Attributes.
3 Choose Device Info.
You can choose a foreground and background color. The foreground color is the color
you draw with the left mouse button; the background color is the color you draw with the
right mouse button.
To select the foreground color, click a color in the Colors palette.
To select the background color, right-click a color in the Colors palette.
In the Colors palette, the current foreground and background colors are denoted by the
letters FG and BG respectively. The letters FB denote a color that is both the foreground
and background color.

Choosing a color that represents a transparent or inverted area


When you’re editing an icon or cursor, you can choose the colors that represent
transparent and inverted areas.
• A transparent area “drops out” at run time, allowing the color behind the icon or
cursor to show through. Transparency is especially useful in cursors, where you
rarely use the entire image area.
• The inverted area reverses the color behind the icon or cursor at run time. You can use
an inverted area to make part of an icon or cursor visible at all times, regardless of the
color beneath it.

Choosing a pen style


The pen style affects the width of a line or shape border and whether a line or shape
border is solid, dashed, or dotted.
To choose a pen style,
1 In the Tools palette, click the Pen Style tool.
2 Choose a pen style.
3 Click OK.

Chapter 13, Working with graphics 189


The pen style appears in the Pen Style tool.

Choosing a brush shape


You can choose a brush shape for the Paintbrush or Airbrush tool.
To choose a brush shape,
1 Select the Paintbrush Shape or Airbrush Shape tool.
2 Select a brush shape.
3 Choose OK.
The brush shape appears in the Paintbrush Shape or Airbrush Shape tool.

Choosing a paint pattern


The paint pattern affects the interior of a filled shape and the painting styles of the
Airbrush and Paintbrush tools.
To choose a paint pattern,
1 Select the Paint Pattern tool.
2 Select a paint pattern.
3 Choose OK.
The paint pattern appears in the Paint Pattern tool.

Drawing and painting


You can draw and paint with the Pen, Paintbrush, and Airbrush tools. The output of the
Pen tool depends on the current pen style; the output of the Paintbrush and Airbrush
tools depends on the current brush shape and paint pattern.
The Airbrush tool differs from the Paintbrush tool in that if you drag it slowly, the
Airbrush tool paints a thick pattern, but it you drag it quickly, it paints a scattered,
thinner pattern.
The size of the area covered by the Airbrush and Paintbrush tools is proportionate to the
size of the Drawing Area. Therefore, you can zoom out to paint a larger area, and zoom
in to paint a smaller area. For more information about zooming in and out, see the
section “Zooming in on or out from a graphic” on page 194.
To draw or paint,
1 In the Tools palette, select the Pen, Paintbrush, or Airbrush tool.
2 In the Drawing Area, move the cursor to where you want to start drawing, and then
click and hold down the left mouse button (for the foreground color) or the right
mouse button (for the background color).
3 Drag the cursor around the drawing area.
Drawing
4 When you’re done drawing or painting, release the mouse button.
tools

190 User’s Guide


Drawing a line
To draw a line,
1 In the Tools palette, select the Line tool.
2 In the Drawing Area, move the cursor to where you want the line to start, and then
Line tool click and hold down the left mouse button (for the foreground color) or the right
mouse button (for the background color).
3 To draw a line with a 0-, 45-, or 90-degree angle, hold down Shift.
4 Move the cursor to where you want the line to end, and then release the mouse
button.

Drawing a shape
You can draw a filled or unfilled rectangle, rounded rectangle, or ellipse.
The interior of a filled shape depends on the current paint pattern, and the shape border
depends on the current pen style. To draw a shape without a border, choose Null for the
pen style.
To draw a shape,
1 In the Tools palette, select a shape tool.
2 In the Drawing Area, move the cursor to where you want a corner of the shape, and
then click and hold down the left mouse button (for the foreground color) or the right
mouse button (for the background color).
3 To draw a square or circle, hold down Shift.
Filled
shape 4 Move the cursor to the opposite corner of the shape, and then release the mouse
tools button.

Filling an area with color


You can fill any area that is bounded by one or more different colors.
To fill an area with color,
1 In the Tools palette, select the Paint Can tool.
2 In the Drawing Area, move the crosshairs into the area that you want to fill, and then
Paint Can click the left mouse button (for the foreground color) or the right mouse button (for
tool the background color).
Note Because of problems inherent in some display drivers, the Paint Can tool doesn’t always
work properly. To solve this problem, you can use an alternative flood-filling algorithm
that’s more reliable, but slower. To enable this algorithm, add the following line to the
[RWS_Icon] section of the WORKSHOP.INI file:
RWS_OwnFloodFill=1
The following example shows an edited RWS_Icon section:

Chapter 13, Working with graphics 191


[RWS_Icon]
RWS_OwnFloodFill=1
PercentLeft=69
ZoomLeft=8
ZoomRight=1
bVert=1

Adding text
To add text to a graphic,
1 In the Tools palette, select the Text tool.
2 In the Drawing Area, click where you want to add the text.
Text tool
3 Type the text.
4 To change the alignment of the text relative to the position you specified in step 2,
choose Text|Align Left, Text|Align Center, or Text|Align Right.
5 To change the font, choose Text|Font. Then specify a font name, size, and style, and
then choose OK.
6 To change the color of the text, click on a new color in the Colors palette.
When you perform another action, the text becomes part of the graphic; at that point,
you won’t be able to select or edit the text directly. However, you can erase the area that
contains the text and then add new text.

Erasing an area
You can erase an area by drawing or painting with the background color or by using the
Eraser tool. The Eraser tool allows you to paint with the background color when you
press the left mouse button, and with the foreground color when you press the right
Eraser tool
mouse button.
You can also fill the entire Drawing Area with the background color by double-clicking
the Eraser tool.
The size of the Eraser tool is proportionate to the size of the Drawing Area. Therefore,
you can zoom out to erase a larger area, and zoom in to erase a smaller area. For more
information about zooming in and out, see the section “Zooming in on or out from a
graphic” on page 194.

Selecting an area
You can align, copy, move, or remove any area that you select.
To select a rectangular area,
1 In the Tools palette, select the Pick Rectangle tool.
Pick
Rectangle 2 In the Drawing Area, move the cursor to a corner of the area you want to select, and
tool then click and hold down the mouse button.

192 User’s Guide


3 Move the cursor to the opposite corner of the area you want to select and then release
the mouse button.
To select a non-rectangular area,
1 In the Tools palette, select the Scissors tool.
2 In the Drawing Area, move the cursor to a boundary of the area you want to select,
Scissors and then click and hold down the mouse button.
tool
3 Draw a closed shape around the area you want to select, and then release the mouse
button.

Aligning an area
You can align an area with the top, bottom, sides, or center of a graphic.
To align an area,
1 Select the area.
2 Choose Options|Align.
3 Choose a horizontal alignment option.
4 Choose a vertical alignment option.
5 Click OK.
Note Any area left open is filled with the current background color.

Moving or resizing an area


To move an area,
1 Select the area.
2 Drag the area to a new location.
To move or resize an area,
1 Select the area.
2 Choose Options|Size.
3 To move the area, specify new pixel coordinates for the Top and Left sides.
4 To resize the area, specify a new height and width.
5 Click OK.
Note Any area left open is filled with the current background color.

Copying or removing an area


To copy or remove an area, select the area, and then use the Edit|Copy, Edit|Paste, and
Edit|Duplicate commands. (The Edit|Duplicate command is equivalent to choosing
Edit|Copy and Edit|Paste.)
Note Any area left open is filled with the current background color.

Chapter 13, Working with graphics 193


Zooming in on or out from a graphic
To zoom in on a graphic,
• In the Tools palette, double-click the Zoom tool. Or press Ctrl+Z. Or choose View|
Zoom In.
Zoom tool To zoom in on a particular area of a graphic,
1 Select the Zoom tool.
2 In the Drawing Area, move the cursor to a corner of the area, and then click and hold
down the mouse button.
3 Move the cursor to the opposite corner of the area and then release the mouse button.
To zoom out from a graphic,
• In the Tools palette, hold down Shift and then double-click the Zoom tool. Or press
Ctrl+O. Or choose View|Zoom Out.
To view the actual size of a graphic,
• Press Ctrl+A. Or choose View|Actual size.

Moving a graphic around in the Drawing Area


If a graphic is too large for the Drawing Area, you can move the graphic around to see
its other parts.
To move a graphic around in the Drawing Area,
1 Hold down Ctrl.
The cursor becomes the Hand tool.
2 Drag the graphic to a new position.
You can also move a graphic around with the scroll bars on the right and bottom sides
of the Drawing Area.
Note You can’t use the Hand tool and the Text tool at the same time.

Viewing an icon or cursor in another resolution


To simulate the appearance of an icon or cursor in another screen resolution, choose the
appropriate command from the View menu.

If you’re creating this type of You can view the icon or


icon or cursor cursor in this resolution By choosing this command
A 16x16 or 16x32 icon or a cursor EGA/VGA View|EGA/VGA Resolution
with 1 bit per pixel

194 User’s Guide


If you’re creating this type of You can view the icon or
icon or cursor cursor in this resolution By choosing this command
A 32x32 icon or a cursor with 4 CGA View|CGA Resolution
bits per pixel
A 64x64 icon or a cursor with 8 CGA or VGA View|CGA Resolution or View|
bits per pixel EGA/VGA Resolution

To view the actual size of an icon or cursor, choose View|Actual Size.

Testing an icon or cursor


To test an icon or cursor, choose the Icon |Test or Cursor|Test command. When you
test an icon, the Edit window for the icon is minimized and represented by the test icon.
When you test a cursor, the Resource Workshop cursor becomes the test cursor.
To stop testing an icon, restore its Edit window by double-clicking the icon.
To stop testing a cursor, click anywhere.

Adding or removing an image from an icon or cursor


In general, you create a new icon resource for each icon design (called simply an icon),
and you don’t put different icons in the same icon resource. However, it’s likely you’ll
want to put different color formats of the same icon in one icon resource. These color
variations on the same icon are called images. For example, if you want a 2-color and a
16-color version of the same design, you can store both versions in the same icon
resource.
The reason the icon resource supports different color formats is that Windows picks a
color format based on the ability of the display hardware to support the format.
Windows picks a 2-color format for a monochrome display driver and a 16-color format
for a standard Windows VGA driver.
To add a new image to an existing icon or cursor,
1 In the Project window, double-click the icon or cursor.
2 Choose Images|New Image.
3 If you’re creating a new icon image, specify the size and maximum number of colors.
If you don’t know which size and color options to specify, accept the default values.
For information about changing the size and color options, see the section “Changing
the properties of an icon” on page 197.
4 If you’re creating a new cursor image, specify the bits per pixel. If you don’t know
which option to specify, accept the default values. For information about changing
the bits per pixel option, see the section “Changing the properties of a cursor” on
page 196.
5 Choose OK.
To remove an image from an icon or cursor,

Chapter 13, Working with graphics 195


1 In the Image window for the icon or cursor, select the image that you want to
remove.
2 Press Del.

Changing the properties of a bitmap


You can change the following properties of a bitmap:
• The height and width
• Whether the bitmap is stored in a compressed format
• The maximum number of colors for the bitmap
• Whether the bitmap is stored in the Windows or OS/2 format
To change the properties of a bitmap,
1 Choose Bitmap|Size and Attributes.
2 To change the size of the bitmap, type the new height and width in the appropriate
boxes.
3 If you changed the height or width, but you don’t want to stretch or compress the
current bitmap into the new area, deselect the Stretch Current Bitmap box.
4 To save a 16- or 256-color bitmap in a compressed format, choose RLE 4 (for 16-color
bitmaps) or RLE 8 (for 256-color bitmaps).
Note Some display drivers do not support RLE compression. Also, the RLE compression
algorithm can increase the size of bitmaps that don’t have many adjacent pixels with
the same color. For example, RLE compression might increase the size of a scanned
photograph. Therefore, you should use RLE compression with caution.
5 In the Colors group, choose the maximum number of colors for the bitmap.
Depending on the capabilities of your display device and driver, you might be
limited to two or sixteen colors.
6 In the Format group, choose an operating system format for the bitmap. You can use
the Windows or OS/2 formats.
7 Choose OK.

Changing the properties of a cursor


You can set the hot spot of a cursor. The hot spot is a single pixel from which the x- and
y-coordinates of the cursor are determined. The location of the hot spot should be
evident from the cursor image; for example, an arrow-shaped cursor should have its hot
spot at the tip of the arrow.
Before you add a hot spot to a cursor, you should determine the exact coordinates for
the hot spot. To pinpoint the coordinates, you can zoom in on the cursor, place a
drawing tool over the pixel you want, and then note the coordinates in the status bar.
To set the hot spot,

196 User’s Guide


1 Choose Cursor|Set Hot Spot.
2 Type the x- and y-coordinates for the hot spot.
3 Choose OK.

Changing the properties of an icon


You can change the size of and the maximum number of colors for an icon:
1 Choose Icon|Size and Attributes.
2 In the Size box, choose the size of the icon in pixels.
3 In the Colors box, choose the maximum number of colors for the icon. Depending on
the capabilities of your display device and driver, you may be limited to two or
sixteen colors.
4 Choose OK.

Changing the properties of a font


You can change the following properties of a font:
• General properties, such as copyright and version information
• The height and width of the characters
• The number of characters
• The ANSI codes for the characters

Changing the general properties of a font


To change the general properties of a font,
1 Choose Font|Header.
2 Specify any of the following options:

Option Description
Face Name Type a name that you want to assign to your font.
Device Type a device name for your font if you want to inform your programs that this font
can be used only on a particular device.
Copyright Type copyright information for your custom font.
Font Version Font version 2.00 is supported in all cases. You can use version 3.00 if you’re creating
a Windows 3.x application that will run in a protected mode environment (Standard
mode or 386 Enhanced mode) on an 80386 (or later) processor.
Italic The font contains italicized characters.
Underline The font contains underlined characters.
Strikeout The font contains characters that are struck out.
Proportional The font is a variable-width font.
Weight The font is of normal weight (400) or boldfaced (700).
Family Describes the font family. The acceptable values are: Don’t care (0), Roman (1), Swiss
(2), Modern (3), Script (4), and Decorative (5).

Chapter 13, Working with graphics 197


Option Description
Char Set Defines the character set. The value can be 0 through 255. 0, 2, and 255 have the
following predefined meanings: ANSI, the default Windows character set (0);
Symbol, used for math and scientific formulas (2); OEM, a machine-specific character
set (255).
Horz Res Horizontal number of pixels per logical inch on your video display.
Vert Res Vertical number of pixels per logical inch on your video display.
Points Type size. A point is 1/72 of an inch. A character is measured from the top of the
ascender to the bottom of the descender. The value you enter here should not include
space for diacritical marks.
Internal The space in pixels reserved for diacritical marks.
Leading
External The additional space in pixels between lines of characters.
Leading
Ascent The height in pixels of the character above the baseline.

Changing the height and width of the characters in a font


To change the height and width of characters in a font,
1 Choose Font|Font Size.
2 In the Width box, type the width of the font. Type 0 if the width of the characters in
the font can vary. (Variable-width fonts usually take less space and are more pleasing
to the eye than fixed-width fonts.)
3 In the Height box, type the height of the font.
4 If you typed 0 for the width, type the maximum width of the characters in the font.
5 If you changed the height or width of the font, and you want to stretch or compress
the existing characters into the new area, select the Stretch Current Characters box.
6 Choose OK.
If you use the Font|Font Size command to specify that the width of characters in a font
can vary, you can change the width of each character in the font.
To change the width of a single character in a font,
1 Select the character in the right border of the Edit window.
2 Choose Font|Font Character Width.
3 Type a new width for the character.
4 If you want to stretch or compress the existing character into the new area, select the
Stretch Current Char box.
5 Choose OK.

Changing the ANSI codes of the characters in a font


The ANSI values to which you map a set of bitmapped images are arbitrary, but must
be in the range 0 to 255. These ANSI values become important when you load the font in

198 User’s Guide


your program and display the bitmaps; you use the ANSI value that corresponds to a
bitmap to display it, the same as you would use an ANSI value to display a character.
To change the ANSI codes of the characters in a font,
1 Choose Font|Font Size.
2 In the First box, type the ANSI code for the first character in the font.
3 In the Last box, type the ANSI code for the last character in the font.
4 In the Default box, type the ANSI code for the character that appears first when you
load the font into the Graphic editor.
5 In the Break box, type the ANSI code for the break character. (The break character,
typically a space, is used to pad justified lines.)
6 Choose OK.

Changing the number of characters in a font


To change the number of characters in a font, change the ANSI code for the first or last
character in the font. (This procedure is described in the previous section.) The number
of characters in the font equals the difference between the ANSI codes of the first and
last characters.

Editing a specific character in a font


When you load a font into the Graphic editor, the first character of the font appears
automatically in the Edit window. To bring another character into the Edit window,
click the character in the right border of the Edit window.
For more information about fonts, see the section “Changing the properties of a font” on
page 197.

Customizing the Graphic editor


You can customize the Graphic editor by
• Adding or removing a second pane from the Edit window
• Hiding or showing the Colors and Tools palettes
• Changing a color on the Colors palette
• Specifying whether the Colors palette is saved when you exit Resource Workshop
• Specifying whether a grid appears in the Drawing Area when you zoom in on a
graphic

Adding or removing a second pane from the Edit window


In the Graphic editor, you can look at two different views of the image you’re creating
or editing. You can split the window vertically or horizontally to show the two views

Chapter 13, Working with graphics 199


side-by-side or one view above the other. You can also choose how to zoom in on or out
from each view.
To split the window, choose View|Split Horizontal or View|Split Vertical.
When the window is split, one of the panes is active. The active pane is the one in which
you’re working. To make a pane active, click it.
To see more of one pane than the other, move the cursor to the line that splits the images
(the separator bar) and, when the cursor becomes a double arrow, drag the separator
bar.
To use a single-pane view, drag the separator bar to the far left or right (for a vertical
split) or to the top or bottom (for a horizontal split).
If you add a second pane to the Edit window, you can specify whether changes are
reflected in the inactive pane while you draw or paint or when you release the mouse
button after drawing or painting.
To specify when changes are reflected in the inactive pane,
1 Choose Options|Editor Options.
2 Select or deselect the Draw on Both Images box.
3 Choose OK.

Hiding or showing the Tools and Colors palettes


To hide the Tools or Colors palette, double-click the System menu in the upper left
corner of the palette.
You can also hide the Tools or Colors palette by choosing the Hide Toolbox or Hide
Palette command. The name of the menu where you’ll find this command depends on
the type of resource you’re currently editing. For example, if you’re editing an icon, the
Hide Palette command is in the Icon menu. If you’re editing a cursor, the menu is in the
same position on the menu bar, but it is called the Cursor menu.
To show the Tools or Colors palette, choose the Show Palette or Show Toolbox
command on the appropriate menu.

Changing a color on the Colors palette


To change a color on the Colors palette,
1 In the Colors palette, double-click the color.
2 In the Red, Green, and Blue boxes, type values from 0 to 255 to indicate the intensities
of each color. (The colors are mixed together to form the new color.)
3 To return the color to its default value, choose Default (if your display device and
drive doesn’t support 256 colors) or System (if your display device and driver does
support 256 colors).
4 Choose OK.
Note You can’t change the Colors palette when you’re editing a font or cursor.

200 User’s Guide


Specifying whether the Colors palette is saved
To specify whether the Colors palette is saved when you exit Resource Workshop,
1 Choose Options|Editor Options.
2 Select or deselect the Save with default colors box. (If you deselect the box, any
changes you make to the Colors palette will be saved when you exit Resource
Workshop.)
3 Choose OK.

Specifying whether a grid appears when you zoom in


To specify whether a grid appears in the Drawing Area when you zoom in on a graphic,
1 Choose Options|Editor Options.
2 Select or unselect the Grid on Zoomed Windows box.
3 Choose OK.
Note The grid may not appear if you’re using 256 colors.

Using a graphic resource in an application


You can include graphics in an application using OWL or the Windows API.

Programming a bitmap with OWL


To program a bitmap with OWL, use the TBitmap, TDip, TDibDC, and TClientDC
classes. For example, the following code displays a bitmap in the center of the main
window.
TBitmap bitmap1(GetInstance(), IDB_BITMAP1);
TDib dib1(bitmap1);
TDibDC DibDC1(dib1);
TClientDC mainWindowDC(GetMainWindow()->HWindow);
int centerX = GetMainWindow()->Attr.W / 2;
int centerY = GetMainWindow()->Attr.H / 2;
int bitmapX = bitmap1.Width();
int bitmapY = bitmap1.Height();
mainWindowDC.BitBlt(centerX-bitmapX/2, centerY-bitmapY/2, bitmapX, bitmapY, dibDC1, 0, 0,
SRCCOPY);
In the preceding code, IDB_BITMAP1 is the identifier for the bitmap.
For more information about programming a bitmap with OWL, see the ObjectWindows
Programmer’s Guide.

Chapter 13, Working with graphics 201


Programming an icon with OWL
To program an icon with OWL, use the TFrameWindow::SetIcon function. For example,
the following code assigns an icon to the main window.
GetMainWindow()->SetIcon(this, IDC_ICON1);
In the preceding code, IDC_ICON1 is the identifier for the icon.
For more information about programming an icon with OWL, see the ObjectWindows
Programmer’s Guide.

Programming a cursor with OWL


To program a cursor with OWL, use the TWindow::SetCursor function. For example, the
following code assigns a cursor to the main window.
GetMainWindow()->SetCursor(this, IDC_CURSOR1);
In the preceding code, IDC_CURSOR1 is the identifier for the cursor.
For more information about programming a cursor with OWL, see the ObjectWindows
Programmer’s Guide.

Programming a bitmap with the Windows API


To program a bitmap the Windows API, use the LoadBitmap, GetObject, GetDC,
CreateCompatibleDC, BitBlt, DeleteDC, and ReleaseDC functions. For example, the
following code displays a bitmap in the window represented by the HWnd variable.
HINSTANCE hInst;
HWND hWnd;
HDC hDC, hDCMemory;
HBITMAP hBitmap, hTempBitmap;
BITMAP bitmap;
// Get the bitmap resource and its handle.
hBitmap = LoadBitmap(hInst, MAKEINTRESOURE(IDB_BITMAP1);
// Get the bitmap data.
GetObject(hBitmap, sizeof(BITMAP), &bitmap);
// Get the device context of the target window.
hDC = GetDC(hWnd);
// Create a compatible memory device context
hDCMemory = CreateCompatibleDC(hDC);
// Copy the bitmap into the memory device context.
hTempBitmap = SelectObject(hDCMemory, hBitmap);
// Copy the bitmap into the device context of the target window.
BitBlt(hDC, 0, 0, bitmap.bmWidth, bitmap.bmHeight, hDCMemory, 0, 0, SRCCOPY);
// Clean up and exit.
SelectObject(hDCMemory, hTempBitmap);
DeleteDC(hDCMemory);
ReleaseDC(hWnd, hDC);
In the preceding code, IDB_BITMAP1 is the identifier for the bitmap.

202 User’s Guide


For more information about programming a bitmap with the Windows API, search the
Windows 3.1 SDK Help file (WIN31WH.HLP) for “Bitmap Functions.”

Programming an icon with the Windows API


To program an icon with the Windows API, use the LoadIcon function. For example, the
following code loads an icon resource into a variable.
HICON hIcon;
hIcon = LoadIcon(hInst, MAKEINTRESOURCE(IDD_ICON1)
In the preceding code, IDD_ICON1 is the identifier for the icon.
For more information about programming an icon with the Windows API, search the
Windows 3.1 SDK Help file (WIN31WH.HLP) for “Icon Functions.”

Programming a cursor with the Windows API


To program a cursor with the Windows API, use the LoadCursor and SetCursor
functions. For example, the following code changes the active cursor.
HCURSOR hCursor;
hCursor = LoadCursor(hInst, MAKEINTRESOURCE(IDD_CURSOR1)
SetCursor(hCursor)
In the preceding code, IDD_CURSOR1 is the identifier for the cursor.
For more information about programming a cursor with the Windows API, search the
Windows 3.1 SDK Help file (WIN31WH.HLP) for “Cursor Functions.”

Chapter 13, Working with graphics 203


204 User’s Guide
Chapter

Working with version information


Chapter 14
14
and custom data types
You can define your own resource types to contain data that doesn’t fit into one of the
standard resource types described in Chapters 10–13. For example, to create a string
that’s longer than 255 characters, you can define your own resource type and store your
long strings there.
You can also include metafiles in your project as user-defined resources. A metafile is a
graphic—in source form, it’s made up of a collection of Graphics Device Interface (GDI)
calls. Metafiles are easier to scale and more device-independent than standard bitmaps,
and often require less memory than a bitmap resource.
Like other resources, you define version information or a custom data type in a resource
script. This chapter describes how to edit resource scripts for version information and
custom data types, and how to use the corresponding resources in an application.

Creating a custom data type


To create a custom data type,
1 Choose Resource|New.
2 Choose New Type.
3 Type the name of the new data type.
4 Choose OK.
5 Choose Yes to create a new identifier.
6 Type a value for the identifier.
7 In the File box, choose a header file in which to store the identifier.
8 Choose OK.

Chapter 14, Working with version information and custom data types 205
Editing a resource script for version information
or a custom data type
To edit a resource script for version information or a custom data type, you must start
the Script editor.
To start the Script editor,
1 Add a new resource script for version information or a custom data type. Or open a
resource script file that contains a resource script for version information or a custom
data type.
2 If the Script editor doesn’t start automatically, double-click the version information or
custom data type in the Project window.
The Script editor appears.
Note You can also use an external text editor to edit a resource script for version information
or a custom data type.

Editing a resource script for version information


A resource script for version information has the following syntax:
versionID VERSIONINFO fixed-info
{
block-statements
}

The versionID parameter


The version ID parameter is the resource identifier. It must be set to 1.

The fixed-info parameter


The fixed-info parameter specifies version information about the file to which the version
information resource is linked. It consists of the following statements:

Parameter Description
FILEVERSION version A file version number, which is a 64-bit integer. You can define the 64-
bit integer with four 16-bit integers separated by commas. For example,
“10,11,0,1” represents 0x000a 000b 0000 0001.
PRODUCTVERSION version A product version number, which is a 64-bit integer. You can define the
64-bit integer with four 16-bit integers separated by commas. For
example, “10,11,0,1” represents 0x000a 000b 0000 0001.
FILEFLAGSMASK fileflags The valid bits in FILEFLAGS statement. Use any of the fileflags
constants, which are described in the section “Constants” on page 208.
FILEFLAGS fileflags The Boolean attributes of a file. Use any of the fileflags constants, which
are described in the section “Constants” on page 208.
FILEOS fileos The operating system for a file. Use any of the fileos constants, which are
described in the Constants section. The values 0x00002L, 0x00003L,
0x20000L, and 0x3000L are reserved.

206 User’s Guide


Parameter Description
FILETYPE filetype A file type. Use any of the filetype constants, which are described in the
constants section. All other values are reserved.
FILESUBTYPE subtype The function of a file. The subtype parameter is 0 unless the FILETYPE
statement is FILETYPE VFT_DRV, VFT_FONT, or VFT_VXD. Use any
of the subtype constants, which are described in the section “Constants”
on page 208.

The block-statements parameter


The block-statements parameter specifies string or variable information about the file to
which the version information resource is linked.

A string information block


A string information block has the following syntax:
BLOCK "StringFileInfo"
{
BLOCK "lang-charset" VALUE "string-name", "value"
ƒ
}
}
A string information block has the following parameters:

Parameter Description
lang-charset A string containing a hexadecimal number that represents a character set. The string is a
concatenation of the langID and charsetID constants, which are described in the section
“Constants” on page 208.
string-name The name of the corresponding value in the VALUE statement. Use a custom string or
one of the string-name constants, which are described in the section “Constants” on
page 208.
value The value of the corresponding string-name in the VALUE statement.

A variable information block


A variable information block has the following syntax:
BLOCK "VarFileInfo"
{
VALUE "Translation",
langID, charsetID
ƒ
}
A variable information block has the following parameters.

Parameter Description
langID A string containing a hexadecimal number that represents a language. Use any of the
langID constants, which are described in the Constants section.
charsetID A string containing a hexadecimal number that represents a character set. Use any of
the charsetID constants, which are described in the Constants section.

Chapter 14, Working with version information and custom data types 207
Constants
If you include the ver.h file in the resource script file that contains the version
information resource, you can use constants for the fileflags, fileos, filetype, subtype, langID,
and charsetID parameters.

fileflags
You can specify the following constants for the fileflags parameter:

Constant Description
VS_FF_DEBUG Debugging—file contains debugging information or was compiled with
debugging features enabled.
VS_FF_INFOINFERRED Incorrect version information—file contains a dynamically created
version information resource with possible empty or incorrect blocks. Do
not use this value in version information resources created with the
VERSIONINFO statement.
VS_FF_PATCHED Patch—file has been modified; it is not identical to the original shipping
file of the same version number.
VS_FF_PRERELEASE Prerelease—file is a development version, not a commercially released
product.
VS_FF_PRIVATEBUILD Private build—file was not built using standard release procedures.
When you use this value, include the PrivateBuild string in the string-
name parameter.
VS_FF_SPECIALBUILD Special build—file was built by the original company using standard
release procedures, but is a variation of the standard file of the same
version number. When you use this value, include the SpecialBuild string
in the string-name parameter.

fileos
You can specify the following constants for the fileos parameter:

Constant Description
VOS_UNKNOWN File designed for unknown operating system.
VOS_DOS File designed for MS-DOS.
VOS_NT File designed for Windows NT.
VOS_WINDOWS16 File designed for Windows 3.0 or later.
VOS_WINDOWS32 File designed for Windows 32-bit.
VOS_DOS_WINDOWS16 File designed for Windows 3.0 or later running on MS-DOS.
VOS_DOS_WINDOWS32 File designed for Windows 32-bit running on MS-DOS.
VOS_NT_WINDOWS32 File designed for Windows 32-bit running on Windows NT.

filetype
You can specify any of the following constants for the filetype parameter:

Constant Description
VFT_UNKNOWN File type is unknown to Windows.
VFT_APP File contains an application.
VFT_DLL File contains a dynamic-link library.

208 User’s Guide


Constant Description
VFT_DRV File contains a device driver. If you use this constant, include a more
specific description of the driver in FILESUBTYPE.
VFT_FONT File contains a font. If you use this constant, include a more specific
description of the font file in FILESUBTYPE.
VFT_VXD File contains a virtual device. If you use this constant, include a more
specific description of the device in FILESUBTYPE.
VFT_STATIC_LIB File contains a static-link library.

subtype
If the FILETYPE statement specifies VFT_DRV, you can specify any of the following
constants for the subtype parameter:

Constants Description
VFT2_UNKNOWN Driver type is unknown to Windows.
VFT2_DRV_COMM File contains a communications driver.
VFT2_DRV_PRINTER File contains a printer driver.
VFT2_DRV_KEYBOARD File contains a keyboard driver.
VFT2_DRV_LANGUAGE File contains a language driver.
VFT2_DRV_DISPLAY File contains a display driver.
VFT2_DRV_MOUSE File contains a mouse driver.
VFT2_DRV_NETWORK File contains a network driver.
VFT2_DRV_SYSTEM File contains a system driver.
VFT2_DRV_INSTALLABLE File contains an installable driver.
VFT2_DRV_SOUND File contains a sound driver.

If the FILETYPE statement specifies VFT_FONT, you can specify any of the following
constants for the subtype parameter:

Constant Description
VFT2_UNKNOWN Font type is unknown to Windows.
VFT2_FONT_RASTER File contains a raster font.
VFT2_FONT_VECTOR File contains a vector font.
VFT2_FONT_TRUETYPE File contains a TrueType font.

If the FILETYPE statement specifies VFT_VXD, you can’t specify a value for the subtype
statement.

langID
You can specify any of the following constants for the langID parameter:

Constant Description Constant Description


0x0401 Arabic 0x0418 Romanian
0x0402 Bulgarian 0x0419 Russian
0x0403 Catalan 0x041A Croato-Serbian (Latin)

Chapter 14, Working with version information and custom data types 209
Constant Description Constant Description
0x0404 Traditional Chinese 0x041B Slovak
0x0405 Czech 0x041C Albanian
0x0406 Danish 0x041D Swedish
0x0407 German 0x041E Thai
0x0408 Greek 0x041F Turkish
0x0409 U.S. English 0x0420 Urdu
0x040A Castilian Spanish 0x0421 Bahasa
0x040B Finnish 0x0804 Simplified Chinese
0x040C French 0x0807 Swiss German
0x040D Hebrew 0x0809 U.K. English
0x040E Hungarian 0x080A Mexican Spanish
0x040F Icelandic 0x080C Belgian French
0x0410 Italian 0x0810 Swiss Italian
0x0411 Japanese 0x0813 Belgian Dutch
0x0412 Korean 0x0814 Norwegian–Nynorsk
0x0413 Dutch 0x0816 Portuguese
0x0414 Norwegian–Bokmal 0x081A Serbo-Croatian (Cyrillic)
0x0415 Polish 0x0c0C Canadian French
0x0416 Brazilian Portuguese 0x100C Swiss French
0x0417 Rhaeto–Romanic

charsetID
You can specify any of the following constants for the charsetID parameter:

Constant Description
0 7-bit ASCII
932 Windows, Japan (Shift - JIS X-0208)
949 Windows, Korea (Shift - KSC 5601)
950 Windows, Taiwan (GB5)
1200 Unicode
1250 Windows, Latin-2 (Eastern European)
1251 Windows, Cyrillic
1252 Windows, Multilingual
1253 Windows, Greek
1254 Windows, Turkish
1255 Windows, Hebrew
1256 Windows, Arabic

210 User’s Guide


string-name
You can specify any of the following constants for the string-name parameter:

Constant Description
Comments Additional information for diagnostic purposes. Optional.
CompanyName The company that produced the file. Required.
FileDescription File description. You can display this string in a list box during installation.
Required.
FileVersion File version number. Required.
InternalName File internal name. If file does not have internal name, use original filename,
without extension. Required.
LegalCopyright File copyright notices. Optional.
LegalTrademarks Trademarks and registered trademarks that apply to file. Optional.
OriginalFilename Original file name, not including path. Required.
PrivateBuild Information about private version of file. Required if VS_FF_PRIVATEBUILD is
set in FILEFLAGS.
ProductName Name of product that file is distributed with. Required.
ProductVersion Version of product that file is distributed with. Required.
Special Build Specifies how this version of file differs from standard version. Required if
VS_FF_SPECIALBUILD is set in FILEFLAGS.

Editing a resource script for a custom data type


A resource script for a custom data type has the following syntax:
resource-name type-ID [load-type] [memory-option] filename
{
block-statements
}

The resource-name parameter


The resource-name parameter sets the identifer for the resource.

The type-ID parameter


The type-ID parameter sets the resource type. You must set the type-ID to a number
greater than 255. (Numbers 1 to 255 are reserved by Windows for predefined resource
types and future expansion.)

The load-type parameter


The way in which the resource is loaded into memory. You can set the load-type
parameter to
• PRELOAD, which means the resource is loaded when its application starts.
• LOADONCALL, which means the resource is loaded when it is needed.

Chapter 14, Working with version information and custom data types 211
The filename parameter
The name of the DOS file containing the user data. A full path name can be used to
specify files which are not in the current working directory. The data in the specified file
is included in the current project.

The block-statements parameter


You can specify string or variable blocks. For more information, see the section “Editing
a resource script for version information” on page 206.

Entering data in a resource script


Here are some guidelines for specifying data between the begin ({) and end (})
parameters:
• The data can include any combination of numeric values and strings.
• You can use hexadecimal, octal, or decimal notation to represent numeric values.
• Use 0x (a zero followed by the letter x) or $ (a dollar sign) as the leading characters
for hexadecimal notation. This notation supports only 16-bit values. If you want to
use an odd number of hexadecimal values, use the hexstring data type (described
in the next bullet).
• Use 0o (a zero followed by the letter o) or just 0 (zero) as the leading characters for
octal notation.
• You can also represent hexadecimal values by using a hexstring of hexadecimal
values enclosed in single quotation marks. The compiler ignores any spaces you
insert to make the hex codes more readable. For example, you could represent the
ASCII values of the characters in the word string as '73 74 72 69 6E 67' and the hex
number 06E07A as '06E07A'.
• If you include text strings in your resource, enclose the strings in quotation marks,
like this: "string". Strings aren’t automatically null terminated. To terminate a string
with a null character, type \0 (backslash zero) at the end of the string.
For example, here’s what a resource script might look like:
RESTYPE_1 RESTYPE
{
"This is a string."
0xFFAA 0o7076 01077
'54 68 69 73 20 69 73 0D 0A 73 6F 6D 65 20 73 61'
'6D 70 6C 65 0D 64 61 74 61 2E'
}

Compiling a resource script


You can compile a resource script by choosing Compile|Compile Now or by pressing
Alt+F9.

212 User’s Guide


If there’s a compilation error, Resource Workshop displays an error message. Read the
error message and click OK when you’re done. Resource Workshop puts you back into
the Script editor so that you can fix the error.

Using a version information resource in an application


To include a version information resource in an application, use any of the version
functions. For information about the version functions, search the Windows 3.1 SDK
Help file (WIN31WH.HLP) for “Version Functions (3.1).”
For example, the following code loads the loads version information data into variables.
LPBYTE companyName;
char appFileName[255];
BYTE versionInfoData[1024];
DWORD versionInfoHandle;
UINT dwSize;
UINT vSize;
LPBYTE translationBlock;
char blockName[255]'
GetModuleFileName(hInst, appFileName, sizeof(appFileName));
dwSize = (UINT) ::GetFileVersionInfoSize(appFileName, &versionInfoHandle);
if (dwSize) {
::GetFileVersionInfo(appFileName, versionInfoHandle, dwSize, versionInfoData);
strcpy(blockName, "\\VarFileInfo\\Translation");
::VerQueryValue(versionInfoData, blockName, (void FAR* FAR*) &translationBlock,
&vSize);
*(DWORD *)translationBlock = MAKELONG(HIWORD(*(DWORD *)translationBlock),
LOWORD(*(DWORD *)translationBlock));
wsprintf(blockName, "\\StringFileInfo\\%081x\\CompanyName", *(DWORD
*)translationBlock);
::VerQueryValue(versionInfoData, blockName (void FAR* FAR*) &companyName, &vSize);
}

Using a resource for a custom data type in an application


To include a custom data type resource in an application, use the FindResource,
LockResource, and UnlockResource functions. For example, the following code loads and
unloads a resource for a custom data type.
HRSRC hRCData;
HGLOBAL hRCDataMem;
BYTE * pRCDataMem;
// Get a handle for the resource.
hRCData = FindResource(hInst, MAKEINTRESOURCE(IDR_CUSTOM1);
// Load the resource into global memory.
hRCDataMem = LoadResource(hInst, hRCData);
// Lock the resource into memory so it can be used.
pRCDataMem = (BYTE*)LockResource(hRCDataMem);
// Replace this line with code that uses the resource.
// Unlock and free the memory used by the resource.

Chapter 14, Working with version information and custom data types 213
UnlockResource(hRCDataMem);
FreeResource(hRCDataMem);
For more information about using a resource for a custom data type in an application,
search the Windows 3.1 SDK Help file (WIN31WH.HLP) for “FindResource (2.x).”

214 User’s Guide


Appendix

Using EasyWin
Appendix A
A
EasyWin is a feature of Turbo C++ that lets you compile standard DOS applications that
use traditional “TTY style” input and output so they run as true Windows programs.
EasyWin does not require you to make any changes to a DOS program in order to run it
under Windows.
To convert your console-based applications that use standard files or iostream
functions, check the EasyWin Target Type in TargetExpert in the IDE. If you are using
the command-line compiler, use the compiler switch –W. Turbo C++ notes that your
program doesn’t contain a WinMain function (normally required for Windows
applications) and links the EasyWin library. When you run your program in Windows,
a standard window is created, and your program takes input and produces output for
that window exactly as if it were the standard screen:

Example C program Example C++ program


#include <stdio.h> #include <iostream.h>
int main () int main()
{ {
printf("Hello DOS!\n"); cout << "Hello DOS!\n";
return 0; return 0;
} }

The EasyWin window can be used any time input or output is requested from or to a
TTY device. This means that in addition to stdin and stdout, the stderr, stdaux, and cerr
“devices” are all connected to this window.

_InitEasyWin( )
EasyWin’s purpose is to convert DOS applications to Windows programs, quickly and
easily. However, you might occasionally want to use EasyWin from within a “true”

Appendix A, Using EasyWin 215


Windows program. For example, you might want to add printf functions to your
program code to help you debug your Windows program.
To use EasyWin from within a Windows program, make a call to the _InitEasyWin
function before doing any standard input or output. For example,
#include <windows.h>
#include <stdio.h>

#pragma argsused
int PASCAL WinMain(HANDLE hInstance, HANDLE hPrevInstance,
LPSTR lpszCmdLine, int cmdShow)
{
_InitEasyWin();

/* Normal windows setup */


printf("Hello, Windows!\n");
return 0;
}
Note You can find the prototype for _InitEasyWin in stdio.h and iostream.h.

Added functions
EasyWin also includes five functions that let you specify the X and Y window
coordinates for input and output, clear the window, or clear to the end of the current
line:

clreol (conio.h) wherex (conio.h)


clrscr (conio.h) wherey (conio.h)
gotoxy (conio.h)

These functions have the same names (and uses) as functions in conio.h header file.
Classes in constrea.h provide conio functionality for use with C++ streams. See the
Turbo C++ Programmer’s Guide for information on constreams and iostreams. See online
Help for a description of the functions available to EasyWin programs.
The following routines are portable to EasyWin programs but are not available in 16-bit
Windows programs. They are provided to ease porting of existing code into a Windows
16-bit application.

fgetchar (stdio.h) printf (stdio.h)


getch (stdio.h) putch (conio.h)
getchar (stdio.h) putchar (stdio.h)
getche (stdio.h) puts (stdio.h)
gets (stdio.h) scanf (stdio.h)
kbhit (conio.h) vprintf (stdio.h)
perror (errno.h) vscanf (stdio.h)

216 User’s Guide


Appendix

Precompiled headers
Appendix B
B
Turbo C++ can generate and subsequently use precompiled headers for your projects.
Precompiled headers can greatly speed up compilation times.

How they work


When compiling large C and C++ programs, the compiler can spend up to half of its
time parsing header files. When the compiler parses a header file, it enters declarations
and definitions into its symbol table. If ten of your source files include the same header
file, this header file is parsed ten times, producing the same symbol table every time.
Precompiled header files cut this process short. During one compilation, the Turbo C++
compiler creates and stores an image of the symbol table on disk. This file is called
BCDEF.CSM by default, and is stored in the same directory as the compiler. Then, if the
header file is used again, the compiler reloads BCDEF.CSM from disk, instead of
parsing all the header files again. Directly loading the symbol table from disk is over ten
times faster than parsing the text of the header files.
Precompiled headers are used only if the following compilations use one or more of the
same header files, the same compiler options, defined macros and so on, as the first
compilation.
If, while compiling a source file, Turbo C++ discovers that the first #includes are
identical to those of a previous compilation (of the same source or a different source), it
loads the binary image for those #includes and parses the remaining #includes.
For a given module, either all or none of the precompiled headers are used: if
compilation of any included header file fails, the precompiled header file isn’t updated
for that module.

Appendix B, Precompiled headers 217


Drawbacks
When using precompiled headers, BCDEF.CSM can become very big because it contains
symbol table images for all sets of includes encountered in your sources. If you don’t
have sufficient disk space, you’ll get a warning saying the write failed because of the
precompiled headers. To fix this, free more disk space and retry the compile. For
information on reducing the size of the BCDEF.CSM file, see “Optimizing precompiled
headers” on page 219.
If you’re using large macros in a makefile in addition to using precompiled headers,
there is a limit of 4K on the macro size.
If a header contains any code, it can’t be precompiled. For example, although C++ class
definitions can appear in header files, you should ensure that only inline member
functions are defined in the header and heed warnings such as “Functions containing
reserved word are not expanded inline.”

Using precompiled headers


You can control the use of precompiled headers in any of the following ways:
• From within the IDE, using the Project Options dialog box. The IDE bases the name
of the precompiled header file on the project name, creating PROJECT.CSM.
• From the command line, using the following options: –H=filename, –Hc,
–H”filename” and –Hu (see “Precompiled headers” on page 48 for more
information).
• From within your code, using the pragmas hdrfile and hdrstop (see the Turbo C++
Programmer’s Guide).

Setting file names


The compiler uses just one file to store all precompiled headers. The default file name is
BCDEF.CSM. You can explicitly set the name with the –H=filename command-line
option or the #pragma hdrfile directive.
Caution! If you notice that your .CSM file is smaller than it should be, the compiler might have
run out of disk space when writing to the .CSM file. When this happens, the compiler
deletes the .CSM to make room for the .OBJ file, then starts creating a new (and therefore
shorter) .CSM file. If this happens, free up some disk space before compiling.

Establishing identity
To use a precompiled header, a file must
• Have the same set of include files, in the same order, as the precompiled header
• Have the same macros defined to identical values as the precompiled header
• Use the same language (C or C++) as the precompiled header

218 User’s Guide


• Use header files with identical time stamps; these header files can be included either
directly or indirectly
In addition, the following options settings must be identical to those used when the
precompiled header was generated:
• Memory model, including SS != DS (–mx)
• Underscores on externs (–u)
• Maximum identifier length (–iL)
• Target DOS (default) or Windows (–W or –Wx)
• DOS overlay-compatible code (–Y)
• Virtual table control (–Vx and –Vmx)
• Expand intrinsic functions inline (–Oi)
• Templates (–Jx)
• String literals in code segment (–dc, 16-bit only)
• Debugging information (–v, –vi, and –R)
• Far variables (–Fx)
• Generate word alignment (–a)
• Pascal calls (–p)
• Treat enums as integers (–b)
• Default char is unsigned (–K)
• Language compliance (–A)
• C++ compile (–P)

Optimizing precompiled headers


For the most efficiently compiled precompiled headers, follow these rules:
• Arrange your header files in the same sequence in all source files.
• Put the largest header files first.
• Prime BCDEF.CSM with often-used initial sequences of header files.
• Use #pragma hdrstop to terminate the list of header files at well-chosen places. This
lets you make the list of header files in different sources look similar to the compiler.
For example, given the two source files ASOURCE.C and BSOURCE.C, both of which
include windows.h and myhdr.h,
\* ASOURCE.C *\
#include <windows.h>
#include "myhdr.h"
#include "xxx.h"
<...>

\* BSOURCE.C *\
#include "yyy.h"
#include <string.h>
#include "myhdr.h"
#include <windows.h>
<...>

Appendix B, Precompiled headers 219


you would rearrange the beginning of BSOURCE.C to
\* Revised BSOURCE.C *\
#include <windows.h>
#include "myhdr.h"
#include "yyy.h"
#include <string.h>
<...>
Note that windows.h and myhdr.h are in the same order in BSOURCE.C as they are in
ASOURCE.C. You could also make a new source called PREFIX.C containing only the
header files, like this:
\* PREFIX.C*\
#include <windows.h>
#include "myhdr.h"
If you compile PREFIX.C first (or insert a #pragma hdrstop in both ASOURCE.C and
BSOURCE.C after the #include "myhdr.h" statement), the net effect is that after the initial
compilation of PREFIX.C, both ASOURCE.C and BSOURCE.C will be able to load the
symbol table produced by PREFIX.C. The compiler will then only need to parse xxx.h
for ASOURCE.C and yyy.h and string.h for BSOURCE.C.

220 User’s Guide


Appendix

Error messages
Appendix C
C
This appendix describes the error messages that can be generated by Turbo C++. The
error messages in this appendix include messages that can be generated by the
compiler, linker, and the Windows Help compiler. This appendix also lists the errors
that you can receive when you run your program (run-time errors).
Messages are listed in ASCII alphabetic order. Messages beginning with symbols come
first, then messages beginning with numbers, and then messages beginning with letters
of the alphabet. Messages that begin with symbols are alphabetized by the first word in
the message that follows the symbols. For example, you might receive the following
error message if you incorrectly declared your function my_func:
my_func must be declared with no parameters
To find this error message, look under the alphabetized listing of “must.”

Message classes
Messages fall into three categories: fatal errors, errors, and warnings.

Fatal errors
Fatal errors can be generated by the compiler and linker. Fatal errors cause the
compilation to stop immediately; you must take appropriate action to fix the error
before you can resume compiling.
If the compiler issues a fatal error, no .EXE file is created. If the linker issues a fatal error,
any .EXE file that might have been created by the linker is deleted before the linker
returns.

Appendix C, Error messages 221


Errors
Errors can be generated by the compiler, the linker, and the librarian. In addition, errors
can be generated by your program at run time.
Errors generated by the compiler indicate program syntax errors, command-line errors,
and disk or memory access errors. Compiler errors don’t cause the compilation to
stop—the compiler completes the current phase of the compilation and then stops and
reports the errors encountered. The compiler attempts to find as many real errors in the
source program as possible during each phase (preprocessing, parsing, optimizing, and
code-generating).
Errors generated by the linker don’t cause the linker to delete the .EXE or .MAP files.
However, you shouldn’t execute any .EXE file that was linked with errors. Linker errors
are treated like fatal errors.
Run-time errors are usually caused by logic errors in your program code. If you receive
a run-time error, you must fix the error in your source code and recompile the program
for the fix to take effect.

Warnings
Warnings can be issued by the compiler, the linker, and the librarian. Warnings do not
prevent the compilation from finishing. However, they do indicate conditions that are
suspicious, even if the condition that caused the warning is legitimate within the
language. The compiler also produces warnings if you use machine-dependent
constructs in your source files.

Help compiler messages


The Help compiler displays messages when it encounters errors or warnings while
building the Help resource file. Messages generated during the processing of the project
file begin with the letter P and are followed by an error number. Messages that occur
during the processing of the RTF topic file(s) begin with the letter R and are followed by
an error number.
Whenever possible, the Help compiler displays the topic number and/or the file name
that contains the error. If you’ve numbered your topics, the topic number is given with
an error message that refers to that topic’s sequential position in your RTF file (first,
second, and so on). These numbers might be identical to the page number shown by
your word processor. In your Help source files, topics are separated by hard page
breaks even though there are no “pages” in the Help system.
Messages beginning with the word “Error” are fatal errors. Errors are always reported,
and no usable Help resource file will result from the build. Messages beginning with the
word “Warning” are less serious in nature. A build with warnings produces a valid
Help resource file that loads under Windows, but the file might contain operational
errors.

222 User’s Guide


Message listings
Messages are written with the message class first, followed by the source file name and
line number where the error was detected, and finally with the text of the message itself.
Some messages include a symbol (such as a variable, file name, or module) that is taken
from your program. Symbols in the message explanations are shown in italics to indicate
that they’re variable in nature.
Be aware that the compiler generates messages as they are detected. Because C and C++
don’t force any restrictions on placing statements on a line of text, the true cause of the
error might be one or more lines before or after the line number mentioned in the error
message.

Message explanations
‘)’ missing in macro invocation MAKE error
A left parenthesis is required to invoke a macro.
( expected Compiler error
A left parenthesis was expected before a parameter list.
) expected Compiler error
A right parenthesis was expected at the end of a parameter list.
, expected Compiler error
A comma was expected in a list of declarations, initializations, or parameters.
: expected after private/protected/public Compiler error
When used to begin a private/protected/public section of a C++ class, these reserved words must be followed by a
colon.
< expected Compiler error
The keyword template was not followed by a left angle bracket ( < ). Every template declaration must include the
template formal parameters enclosed within angle brackets ( < > ), immediately following the template keyword.
> expected Compiler error
A new-style cast (for example, dynamic_cast) is missing a closing “>”.
@ seen, expected a response-files name Librarian error
The response file is not given immediately after @.
{ expected Compiler error
A left brace ( { ) was expected at the start of a block or initialization.
} expected Compiler error
A right brace ( } ) was expected at the end of a block or initialization.
16-bit segments not supported in module module Linker error
16-bit segments aren’t supported in 32-bit applications. Check to make sure that you haven’t inadvertently compiled
your 32-bit application using the 16-bit compiler.
286/287 instructions not enabled Compiler error
Use the –2 command-line compiler option or the 80286 options from the Options|Compiler|Code Generation|
Advanced Code Generation dialog box to enable 286/287 opcodes. The resulting code cannot be run on 8086- and 8088-
based machines.
32-bit record encountered Linker error
An object file that contains 80386 32-bit records was encountered, and the /3 option had not been used.
Abnormal program termination Run-time error
The program called abort because there wasn’t enough memory to execute. This can happen as a result of memory
overwrites.

Appendix C, Error messages 223


Access can only be changed to public or protected Compiler error
A C++ derived class can modify the access rights of a base class member, but only to public or protected. A base class
member cannot be made private.
Added file filename does not begin correctly, ignored Librarian warning
The librarian has decided that the file being added is not an object module, so it will not try to add it to the library. The
library is created anyway.
Address of overloaded function function doesn’t match type Compiler error
A variable or parameter is assigned/initialized with the address of an overloaded function, and the type of the variable/
parameter doesn’t match any of the overloaded functions with the specified name.
Alias alias defined in module module is redefined Linker warning
An ALIAS definition record specified a public symbol substitute that was already defined by another ALIAS. The
second public symbol substitute will be used. ALIAS records are generated by the assembler when the ALIAS directive
is used.
module already in LIB, not changed! Librarian warning
An attempt to use the + action on the library has been made, but there is already an object with the same name in the
library. If an update of the module is desired, the action should be +–. The library has not been modified.
Ambiguity between function1 and function2 Compiler error
Both of the named overloaded functions could be used with the supplied parameters. This ambiguity is not allowed.
Ambiguous member name name Compiler error
A structure member name used in inline assembly must be unique. If it is defined in more than one structure all of the
definitions must agree in type and offset within the structures. The member name in this case is ambiguous. Use the
syntax (struct xxx).yyy instead.
Ambiguous Override of Virtual Base Member func1: func2 Compiler error
A virtual function in a virtual base class was overridden with two or more different functions along different paths in
the inheritance hierarchy.
Ambiguous operators need parentheses Compiler warning
This warning is displayed whenever two shift, relational, or bitwise-Boolean operators are used together without
parentheses. Also, an addition or subtraction operator that appears unparenthesized with a shift operator will produce
this warning. Programmers frequently confuse the precedence of these operators.
Ambiguous override of virtual base member base_function: derived_function Compiler error
This error message is issued when a virtual function that is defined in a virtual base class is overridden with different
functions having two derived classes in the same inheritance hierarchy. For example,
struct VB
{
virtual f();
};

struct A:virtual VB
{
virtual f();
};

struct B:virtual VB
virtual f();
};

224 User’s Guide


struct D:A,B
{
} //errors here
The previous code will be flagged with the following errors:
Error: Ambiguous override of virtual base member VB::f():A::f()
Error: Ambiguous override of virtual base member VB::f():B::f()
Application load & execute error 0001 Compiler error
Application load & execute error FFE0 Compiler error
There was insufficient extended memory available for the protected-mode command-line tool to load.
Array allocated using new may not have an initializer Compiler error
When initializing a vector (array) of classes, you must use the default constructor (the constructor that has no arguments).
Array bounds missing ] Compiler error
Your source file declared an array in which the array bounds were not terminated by a right bracket.
Array must have at least one element Compiler error
ANSI C and C++ require that an array be defined to have at least one element (objects of zero size are not allowed). An
old programming trick declares an array element of a structure to have zero size, then allocates the space actually
needed with malloc. You can still use this trick, but you must declare the array element to have (at least) one element if
you are compiling in strict ANSI mode. Declarations (as opposed to definitions) of arrays of unknown size are still
allowed.
For example,
char ray[]; /* definition of unknown size -- illegal */
char ray[0]; /* definition of 0 size -- illegal */
extern char ray[]; /* declaration of unknown size -- ok */
Array of references is not allowed Compiler error
It is illegal to have an array of references because pointers to references are not allowed and array names are coerced into
pointers.
Array size for ‘delete’ ignored Compiler warning
With the latest specification of C++, it is no longer necessary to specify the array size when deleting an array; to allow
older code to compile, Turbo C++ ignores this construct and issues this warning.
Array size too large Compiler error
The declared array is larger than 64K.
Array variable identifier is near Compiler warning
Whenever you use either the –Ff or –Fm command-line options to set threshold limit, global variables larger than the
threshold size are automatically made far by the compiler. However, when the variable is an initialized array with an
unspecified size, its total size is not known when the decision whether to make it near or far has to be made by the
compiler, and so it is made near. If the number of initializers given for the array causes the total variable size to exceed
the data size threshold, the compiler issues this warning. If problems are caused by having the variable made near (for
example, if the linker reports a group overflow due to too much global data), you must make the offending variable
explicitly far by inserting the keyword far immediately to the left of the variable name in its definition.
Assembler stack overflow Compiler error
The assembler ran out of memory during compilation. Review the portion of code flagged by the error message to
ensure that it uses memory correctly.
Assembler statement too long Compiler error
Inline assembly statements cannot be longer than 480 bytes.
Assigning type to enumeration Compiler warning
Assigning an integer value to an enum type. This is an error in C++, but is reduced to a warning to give existing
programs a chance to work.
Assignment to this not allowed, use X::operator new instead Compiler error
In early versions of C++, the only way to control allocation of a class of objects was to use the this parameter inside a
constructor. This practice is no longer allowed because a better, safer, and more general technique is to instead define a
member function operator new.

Appendix C, Error messages 225


Attempt to export non-public symbol symbol Linker error
This error usually occurs when a .DEF file specifies an EXPORT for a symbol that you either forgot to define or
misspelled.
Attempt to grant or reduce access to identifier Compiler error
A C++ derived class can modify the access rights of a base class member, but only by restoring it to the rights in the base
class. It cannot add or reduce access rights.
Attempting to return a reference to a local object Compiler error
In a function returning a reference type, you attempted to return a reference to a temporary object (perhaps the result of
a constructor or a function call). Because this object will disappear when the function returns, the reference will then be
illegal.
Attempting to return a reference to local variable identifier Compiler error
This C++ function returns a reference type, and you are trying to return a reference to a local (auto) variable. This is
illegal because the variable referred to disappears when the function exits. You can return a reference to any static or
global variable, or you can change the function to return a value instead.
Automatic data segment exceeds 64K Linker error
The sum of the DGROUP physical segment, local heap, and stack exceeds 64K. Fix this by specifying smaller values for
the HEAPSIZE and STACKSIZE statements in the module definition file or by decreasing the size of the near data in
DGROUP. The map file shows the sizes of the component segments in DGROUP. The /s TLINK command-line option
is useful for determining how much each module contributes to DGROUP.
Bad call of intrinsic function Compiler error
You have used an intrinsic function without supplying a prototype, or you supplied a prototype for an intrinsic function
that was not what the compiler expected.
Bad character in parameters –> char Linker error
One of the following characters (or any control character other than horizontal tab, linefeed, carriage return, orCtrl+Z)
was encountered in the command line or in a response file:
" * < = > ? [ ] |
Bad define directive syntax Compiler error
A macro definition starts or ends with the ## operator, or contains the # operator that is not followed by a macro
argument name.
Bad field list in debug information in module module Linker error
This is typically caused by bad debug information in the OBJ file. Borland Technical Support should be informed.
Bad file name filename Linker error
An invalid file name was passed to the linker.
Bad file name format in include directive Compiler error
Include file names must be surrounded by quotes (“filename.h”) or angle brackets (<filename.h>). The file name was
missing the opening quote or angle bracket. If a macro was used, the resulting expansion text is incorrect; that is, it is not
surrounded by < > or “ ”.
Bad filename format in include statement MAKE error
Include file names must be surrounded by quotes or angle brackets. The file name was missing the opening quote or
angle bracket.
Bad file name format in line directive Compiler error
Line directive file names must be surrounded by quotes (“filename.h”) or angle brackets (<filename.h>). The file name
was missing the opening quote or angle bracket. If a macro was used, the resulting expansion text is incorrect; that is, it
is not surrounded by quote marks.
Bad GCD type in GRPDEF, extended dictionary aborted Librarian warning
Bad GRPDEF type encountered, extended dictionary aborted Librarian warning
The librarian has encountered an invalid entry in a group definition (GRPDEF) record in an object module while
creating an extended dictionary. The only type of GRPDEF record that the librarian (and linker) supports is segment
index type. If any other type of GRPDEF is encountered, the librarian won’t be able to create an extended dictionary. It’s
possible that an object module created by products other than Borland tools can create GRPDEF records of other types.
It’s also possible for a corrupt object module to generate this warning.

226 User’s Guide


Bad header in input LIB Librarian error
When adding object modules to an existing library, the librarian has determined that it has a bad library header. Rebuild
the library.
Bad ifdef directive syntax Compiler error
An #ifdef directive must contain a single identifier (and nothing else) as the body of the directive.
Bad LF_POINTER in module module Linker error
This is typically caused by bad debug information in the OBJ file. Borland Technical Support should be informed.
Bad macro output translator MAKE error
Invalid syntax for substitution within macros.
Bad object file filename near file offset offset Linker error
The linker has found a bad OBJ file. This is usually caused by a translator error.
Bad object file record Linker error
Bad object file file near file offset offset Linker error
An ill-formed object file was encountered. This is most commonly caused by naming a source file or by naming an object
file that was not completely built. This can occur if the machine was rebooted during a compile, or if a compiler did not
delete its output object file when a Ctrl+Break was pressed.
Bad OMF record type type encountered in module module Librarian error
The librarian encountered a bad Object Module Format (OMF) record while reading through the object module. The
librarian has already read and verified the header records on the module, so this usually indicates that the object module
has become corrupt in some way and should be re-created.
Bad syntax for pure function definition Compiler error
Pure virtual functions are specified by appending “= 0” to the declaration. You wrote something similar, but not quite
the same.
Bad undef directive syntax Compiler error
An #undef directive must contain a single identifier (and nothing else) as the body of the directive.
Bad undef statement syntax MAKE error
An !undef statement must contain a single identifier and nothing else as the body of the statement.
Bad version number in parameter block Linker error
This error indicates an internal inconsistency in the IDE. If it occurs, exit and restart the IDE. This error does not occur in
the standalone version.
Base class class contains dynamically dispatchable functions Compiler error
Currently, dynamically dispatched virtual tables do not support the use of multiple inheritance. This error occurs
because a class that contains DDVT functions attempted to inherit DDVT functions from multiple parent classes.
Base class class is also a base class of class Compiler warning
A class inherits from the same base class both directly and indirectly. It is best to avoid this non-portable construct in
your program code.
Base class class is inaccessible because also in class Compiler warning
It is not legal to use a class as both a direct and indirect base class because the members are automatically ambiguous.
Try making the base class virtual in both locations.
Base class class is included more than once Compiler error
A C++ class can be derived from any number of base classes, but can be directly derived from a given class only once.
Base class class is initialized more than once Compiler error
In a C++ class constructor, the list of initializations following the constructor header includes base class class more than
once.
Base initialization without a class name is now obsolete Compiler error
Early versions of C++ provided for initialization of a base class by following the constructor header with just the base
class constructor parameter list. It is now recommended that you include the base class name: this makes the code much
clearer, and is required when there are multiple base classes.
Old way:
derived::derived(int i) : (i, 10) { ... }

Appendix C, Error messages 227


New way:
derived::derived(int i) : base(i, 10) { ... }
Bit field cannot be static Compiler error
Only ordinary C++ class data members can be declared static, not bit fields.
Bit field too large Compiler error
This error occurs when you supply a bit field with more than 32 bits.
Bit fields must be signed or unsigned int Compiler error
In ANSI C, bit fields can only be signed or unsigned int (not char or long, for example).
Bit fields must be signed or unsigned int Compiler warning
In ANSI C, bit fields cannot be of type signed char or unsigned char. When not compiling in strict ANSI mode, the
compiler allows such constructs, but flags them with this warning.
Bit fields must contain at least one bit Compiler error
You cannot declare a named bit field to have 0 (or less than 0) bits. You can declare an unnamed bit field to have 0 bits, a
convention used to force alignment of the following bit field to a byte boundary (or word boundary, if you select Word
Alignment). In C++, bit fields must have an integral type; this includes enumerations.
Bit fields must have integral type Compiler error
In C++, bit fields must have an integral type; this includes enumerations.
Body has already been defined for function function Compiler error
A function with this name and type was previously supplied a function body. A function body can be supplied only
once.
Both return and return with a value used Compiler warning
The current function has return statements with and without values. This is legal in C, but is almost always an error.
Possibly a return statement was omitted from the end of the function.
Call of nonfunction Compiler error
The name being called is not declared as a function. This is commonly caused by incorrectly declaring the function or by
misspelling the function name.
Call to function function with no prototype Compiler warning
The “Prototypes required” warning was enabled and you called function function without first giving a prototype for it.
Call to undefined function function Compiler error
Your source file declared the current function to return some type other than void in C++ (or int in C), but the compiler
encountered a return with no value. This is usually some sort of error. int functions are exempt in C because in old
versions of C there was no void type to indicate functions that return nothing.
virtual can only be used with member functions
A data member has been declared with the virtual specifier. Only member functions can be declared virtual.
Can’t grow LE/LIDATA record buffer Librarian error
Command-line error. See the message Out of memory reading LE/LIDATA record from object module.
Can’t inherit non-RTTI class from RTTI base class Compiler error
Can’t inherit RTTI class from non-RTTI base class Compiler error
When virtual functions are present, the RTTI attribute of all base classes must match that of the derived class.
Cannot access an inactive scope Compiler error
You have tried to evaluate or inspect a variable local to a function that is currently not active. (This is an integrated
debugger expression evaluation message.)
Cannot add or subtract relocatable symbols Compiler error
The only arithmetic operation that can be performed on a relocatable symbol in an assembler operand is addition or
subtraction of a constant. Variables, procedures, functions, and labels are relocatable symbols. Assuming thatVar is a
variable and Const is a constant, then the instructions
MOV AX,Const+Const
and
MOV AX,Var+Const

228 User’s Guide


are valid, but the following is not:
MOV AX,Var+Var
Cannot allocate a reference Compiler error
An attempt to create a reference using the new operator has been made; this is illegal because references are not objects
and cannot be created through new.
identifier cannot be declared in an anonymous union Compiler error
The compiler found a declaration for a member function or static member in an anonymous union. Such unions can
contain data members only.
function1 cannot be distinguished from function2 Compiler error
The parameter type lists in the declarations of these two functions do not differ enough to tell them apart. Try changing
the order of parameters or the type of a parameter in one declaration.
Cannot call main from within the program Compiler error
C++ does not allow recursive calls of the function main.
Cannot call near class member function with a pointer of type type Compiler error
Member functions of near classes (classes are near by default in the tiny, small, and medium memory models) cannot be
called using far or huge member pointers. (Note that this also applies to calls using pointers to members.) Either change
the pointer to be near, or declare the class as far.
Cannot cast from type1 to type2 Compiler error
A cast from type type1 to type type2 is not allowed. In C, a pointer can be cast to an integral type or to another pointer. An
integral type can be cast to any integral, floating, or pointer type. A floating type can be cast to an integral or floating
type. Structures and arrays cannot be cast to or from. You cannot cast from a void type.
C++ checks for user-defined conversions and constructors, and if one cannot be found, then the preceding rules apply
(except for pointers to class members). Among integral types, only a constant zero can be cast to a member pointer. A
member pointer can be cast to an integral type or to a similar member pointer. A similar member pointer points to a data
member if the original does, or to a function member if the original does; the qualifying class of the type being cast to
must be the same as or a base class of the original.
Cannot convert type1 to type2 Compiler error
An assignment, initialization, or expression requires the specified type conversion to be performed, but the conversion is
not legal.
Cannot create instance of abstract class class Compiler error
Abstract classes—those with pure virtual functions—cannot be used directly, only derived from.
Cannot create pre-compiled header: code in header Compiler warning
One of the headers contained a non-inline function body.
Cannot create pre-compiled header: initialized data in header Compiler warning
One of the headers contained a global variable definition. In a C header, this message indicates that a global variable was
initialized. In C++ header, this message indicates that a variable was not declared “extern.”
Cannot create pre-compiled header: header incomplete Compiler warning
The pre-compiled header ended in the middle of a declaration. This often happens when there is a missing “}” in a class
definition that is located in a header file.
Cannot create pre-compiled header: write failed Compiler warning
The compiler could not write to the pre-compiled header file. This is usually due to a full disk or a disk that is write
protected.
Cannot define a pointer or reference to a reference Compiler error
It is illegal to have a pointer to a reference or a reference to a reference.
Cannot find class::class(class &) to copy a vector Compiler error
When a C++ class class1 contains a vector (array) of class class2, and you want to construct an object of type class1 from
another object of type class1, there must be a constructor class2::class2(class2&) so that the elements of the vector can
be constructed. This constructor, called a copy constructor, takes just one parameter (a reference to its class).
Usually the compiler supplies a copy constructor automatically. However, if you have defined a constructor for class
class2 that has a parameter of type class2& and has additional parameters with default values, the copy constructor
cannot be created by the compiler. (This is because class2::class2(class2&) and class2::class2(class2&, int = 1)
cannot be distinguished.) You must redefine this constructor so that not all parameters have default values. You can
then define a copy constructor or let the compiler create one.

Appendix C, Error messages 229


Cannot find class::operator=(class&) to copy a vector Compiler error
When a C++ class class1 contains a vector (array) of class class2, and you want to copy a class of type class1, there must be
an assignment operator class2::operator=(class2&) so that the elements of the vector can be copied. Usually the
compiler supplies such an operator automatically. However, if you have defined an operator= for classclass2, but not
one that takes a parameter of type class2&, the compiler will not supply it automatically—you must supply one.
Cannot find default constructor to initialize array element of type class Compiler error
When declaring an array of a class that has constructors, you must either explicitly initialize every element of the array,
or the class must have a default constructor (it will be used to initialize the array elements that don’t have explicit
initializers). The compiler will define a default constructor for a class unless you have defined any constructors for the
class.
Cannot find default constructor to initialize base class class Compiler error
Whenever a C++ derived class class2 is constructed, each base class class1 must first be constructed. If the constructor for
class2 does not specify a constructor for class1 (as part of class2’s header), there must be a constructor class1::class1() for
the base class. This constructor without parameters is called the default constructor. The compiler will supply a default
constructor automatically unless you have defined any constructor for class class1; in that case, the compiler will not
supply the default constructor automatically—you must supply one.
Cannot find default constructor to initialize member identifier Compiler error
When a C++ class class1 contains a member of class class2, and you want to construct an object of type class1 but not from
another object of type class1, there must be a constructor class2::class2() so that the member can be constructed. This
constructor without parameters is called the default constructor. The compiler supplies a default constructor
automatically unless you’ve defined a constructor for class class2. If you have, the compiler won’t supply the default
constructor automatically—you must supply one.
Cannot find MAKE.EXE MAKE error
The MAKE command-line tool cannot be found. Be sure that MAKE.EXE is in either the current directory or in a
directory contained in your directory path.
Cannot generate COM file: data below initial CS:IP defined Linker error
This error results from trying to generate data or code below the starting address (usually 100) of a .COM file. Be sure
that the starting address is set to 100 by using the (ORG 100H) instruction. This error message should not occur for
programs written in a high-level language. If it does, ensure that the correct startup (C0x) object module is being linked
in.
Cannot generate COM file: invalid initial entry point address Linker error
You used the /Tdc or /t option, but the program starting address is not equal to 100H, which is required with .COM files.
Cannot generate COM file: program exceeds 64K Linker error
You used the /Tdc or /t option, but the total program size exceeds the .COM file limit.
Cannot generate COM file: segment-relocatable items present Linker error
You used the /Tdc or /t option, but the program contains segment-relative fixups, which are not allowed with .COM
files.
Cannot generate COM file: stack segment present Linker error
You used the /Tdc or /t option, but the program declares a stack segment, which is not allowed with .COM files.
Cannot generate function from template function template Compiler error
A call to a template function was found, but a matching template function cannot be generated from the function
template.
Cannot have a non-inline function in a local class Compiler error
Cannot have a static data member in a local class Compiler error
All members of classes declared local to a function must be entirely defined in the class definition. This means that such
local classes cannot contain any static data members, and all of their member functions must have bodies defined within
the class definition.
Cannot have multiple paths for implicit rule MAKE error
You can have only one path for each of the extensions in an implicit rule; for example, {path}.c.obj. Multiple path lists
are allowed only for dependents in an explicit rule.
Cannot have path list for target MAKE error
You can only specify a path list for dependents of an explicit rule. For example,

230 User’s Guide


{path1;path2}prog.exe: prog.obj # Invalid
prog.exe: {path1;path2}prog.obj # Valid
Cannot initialize a class member here Compiler error
Individual members of structs, unions, and C++ classes cannot have initializers. A struct or union can be initialized as a
whole using initializers inside braces. A C++ class can be initialized only by the use of a constructor.
Cannot initialize type1 with type2 Compiler error
You are attempting to initialize an object of type type1 with a value of type type2, which is not allowed. The rules for
initialization are essentially the same as for assignment.
Cannot modify a const object Compiler error
This indicates an illegal operation on an object declared to be const, such as an assignment to the object.
Cannot overload ‘main’ Compiler error
main is the only function that cannot be overloaded.
function cannot return a value Compiler error
A function with a return type void contains a return statement that returns a value; for example, an int.
identifier cannot start a parameter declaration Compiler error
An undefined ‘identifier’ was found at the start of an argument in a function declarator. This error usually occurs
because the wrong header file was used. If that isn’t the cause, check to see if the type name is misspelled or if the type
declaration is missing.
identifier cannot start an argument declaration Compiler error
Undefined identifier found at the start of an argument in a function declarator. This error usually occurs because the
wrong header file was used. If that isn’t the cause, check to see if the type name is misspelled or if the type declaration is
missing.
Cannot take address of main Compiler error
In C++ it is illegal to take the address of the main function.
Cannot throw type —ambiguous base class base Compiler error
It is not legal to throw a class that contains more than one copy of a (nonvirtual) base class.
Cannot use tiny or huge memory model with Windows Compiler error
You must use the small, medium, compact, or large memory models when compiling Windows programs.
Cannot write a string option MAKE error
the –W MAKE option writes a character option to MAKE.EXE. If there’s any string option (for example,
–Dxxxx=”My_foo” or –Uxxxxx), this error message is generated.
Cannot write GRPDEF list, extended dictionary aborted Librarian error
The librarian cannot write the extended dictionary to the tail end of the library file. This usually indicates lack of space
on the disk.
Case bypasses initialization of a local variable Compiler error
In C++ it is illegal to bypass the initialization of a local variable in any way. In this instance, there is a case label that can
transfer control past this local variable.
Case outside of switch Compiler error
The compiler encountered a case statement outside a switch statement. This is often caused by mismatched braces.
Case statement missing : Compiler error
A case statement must have a constant expression followed by a colon. The expression in the case statement either is
missing a colon or has an extra symbol before the colon.
catch expected Compiler error
In a C++ program, a try block must be followed by at least one catch block.
Character constant must be one or two characters long Compiler error
Character constants can be only one or two characters long.
Character constant too long MAKE error
A char constant in an expression is too long.
Circular dependency exists in makefile MAKE error
The makefile indicates that a file needs to be up-to-date before it can be built. Take, for example, the explicit rules

Appendix C, Error messages 231


filea: fileb
fileb: filec
filec: filea
This implies that filea depends on fileb, which depends on filec, and filec depends on filea. This is illegal because a file
cannot depend on itself, indirectly or directly.
Class class may not contain pure functions Compiler error
The class being declared cannot be abstract; it therefore cannot contain any pure functions.
Class member member declared outside its class Compiler error
C++ class member functions can be declared inside the class declaration only. Unlike nonmember functions, they cannot
be declared multiple times or at other locations.
Class class is abstrace because of member = 0 Compiler error
This message is always issued in conjunction with the message “Cannot create instance of abstract class class,” and is
intended to make it easier to figure out why a particular class is found to be abstract by the compiler.
For example, consider the following example of an attempt to instantiate an abstract class:
struct VB
{
virtual void f() = 0;
virtual void g() = 0;
virtual void h() = 0;
};

struct D1 : virtual VB
{
void f();
};

struct D2 : virtual VB
{
void h();
};

struct DD : D1, D2
{
}
v; // error: 'DD' is an abstract class
The above code fragment generates the following two error messages:
Error <filename> 21, Cannot creat3e instance of abstract class 'DD'
Error <filename> 21: Class 'DD' is abstract because of 'VB::g() = 0'
Code has no effect Compiler warning
The compiler encountered a statement with operators that have no effect. For example, the statement
a + b;
has no effect on either variable. The operation is unnecessary and probably indicates a bug in your file.
Colon expected MAKE error
Your implicit rule is missing a colon at the end.
.c.obj: # Correct
.c.obj # Incorrect
Command arguments too long MAKE error
The arguments to a command were more than the 511-character limit imposed by DOS.
Command syntax error MAKE error
This message occurs if

232 User’s Guide


The first rule line of the makefile contained any leading whitespace.
An implicit rule did not consist of .ext.ext:.
An explicit rule did not contain a name before the : character.
A macro definition did not contain a name before the = character.
Command too long MAKE error
The length of a command has exceeded 512 characters. You might want to use a response file.
Common segment exceeds 64K Linker error
The program had more than 64K of near uninitialized data. Try declaring some uninitialized data as far.
Compiler could not generate copy constructor for class class Compiler error
The compiler cannot generate a needed copy constructor due to language rules.
Compiler could not generate default constructor for class class Compiler error
The compiler cannot generate a needed default constructor due to language rules.
Compiler could not generate operator= for class class Compiler error
The compiler cannot generate a needed assignment operator due to language rules.
Compiler stack overflow Compiler error
The compiler ran out of memory during compilation. Review the portion of code flagged by the error message to ensure
that it uses memory correctly.
Compiler table limit exceeded Compiler error
One of the compiler’s internal tables overflowed. This usually means that the module being compiled contains too many
function bodies. Making more memory available to the compiler will not help with such a limitation; simplifying the file
being compiled is usually the only remedy.
Compound statement missing } Compiler error
The compiler reached the end of the source file and found no closing brace. This is often caused by mismatched braces.
Condition is always false Compiler warning
Condition is always true Compiler warning
The compiler encountered a comparison of values where the result is always true or false. For example,
void proc(unsigned x) {
if (x >= 0) { } /* always 'true' */
}
Conflicting type modifiers Compiler error
This occurs when a declaration is given that includes, for example, both near and far keywords on the same pointer.
Only one addressing modifier can be given for a single pointer, and only one language modifier (cdecl, pascal, or
interrupt) can be given for a function.
symbol conflicts with module module Linker warning
This indicates an inconsistency in the definition of symbol; TLINK found one virtual function and one common
definition with the same name.
Constant expression required Compiler error
Arrays must be declared with constant size. This error is commonly caused by misspelling a #define constant.
Constant is long Compiler warning
The compiler encountered either a decimal constant greater than 32767 or an octal (or hexadecimal) constant greater
than 65535 without a letter l or L following it. The constant is treated as a long.
Constant member member in class without constructors Compiler error
A class that contains constant members must have at least one user-defined constructor; otherwise, there would be no
way to initialize such members.
Constant member member is not initialized Compiler warning
This C++ class contains a constant member member, which does not have an initialization. Constant members can only
be initialized; they cannot be assigned to.
Constant out of range in comparison Compiler warning
Your source file includes a comparison involving a constant subexpression that was outside the range allowed by the
other subexpression’s type. For example, comparing an unsigned quantity to –1 makes no sense. To get an unsigned

Appendix C, Error messages 233


constant greater than 32767 (in decimal), you should either cast the constant to unsigned or append a letter u or U to the
constant.
When this message is issued, the compiler still generates code to do the comparison. If this code ends up always giving
the same result, such as comparing a char expression to 4000, the code still performs the test.
Constant variable variable must be initialized Compiler error
This C++ object is declared const, but is not initialized. Because no value can be assigned to it, it must be initialized at the
point of declaration.
Constructor cannot be declared const or volatile Compiler error
A constructor has been declared as const and/or volatile, and this is not allowed.
Constructor cannot have a return type specification Compiler error
C++ constructors have an implicit return type used by the compiler, but you cannot declare a return type or return a
value.
Conversion may lose significant digits Compiler warning
For an assignment operator or some other circumstance, your source file requires a conversion from long or unsigned
long to int or unsigned int type. Because int type and long type variables don’t have the same size, this kind of
conversion can alter the behavior of a program.
Conversion of near pointer not allowed Compiler error
A near pointer cannot be converted to a far pointer in the expression evaluation box when a program is not currently
running. This is because the conversion needs the current value of DS in the user program, which doesn’t exist.
Conversion operator cannot have a return type specification Compiler error
This C++ type conversion member function specifies a return type different from the type itself. A declaration for
conversion function operator cannot specify any return type.
Conversion to type will fail for members of virtual base class Compiler error
This warning can occur when a member pointer (whose class contains virtual bases) is cast to another member-pointer
type and you use the –Vv option. This error indicates that if the member pointer being cast happens to point (at the time
of the cast) to a member of class, the conversion cannot be completed, and the result of the cast will be a NULL member
pointer.
Could not allocate memory for per module data Librarian error
The librarian has run out of memory.
Could not create list file filename Librarian error
The librarian could not create a list file for the library. This could be due to lack of disk space.
Could not find a match for argument(s) Compiler error
No C++ function could be found with parameters matching the supplied arguments.
Could not find file filename Compiler error
The compiler is unable to find the file supplied on the command line.
Could not get procedure address from DLL filename Linker error
The linker was not able to get a procedure from the specified DLL. Check to make sure that you have the correct DLL
version.
Could not load DLL filename Linker error
The linker was not able to load the specified DLL. Check to make sure the DLL is on your path.
Could not write output Librarian error
The librarian could not write the output file.
Couldn’t alloc memory for per module data Librarian error
The librarian has run out of memory.
filename couldn’t be created, original won’t be changed Librarian warning
An attempt has been made to extract an object (an ‘*’ action) but the librarian cannot create the object file to extract the
module into. Either the object already exists and is read only, or the disk is full.
Couldn’t build command line to RLINK.EXE Linker error
The command line that was generated by the command line linker was longer than 128 bytes. RLINK.EXE was not run
on the EXE. Shorten the file names passed in the .RES file list, put in fewer .RES files, or run RLINK separately.

234 User’s Guide


Couldn’t exec RLINK.EXE Linker error
The command-line linker could not spawn RLINK.EXE to bind resources. Check to make sure that RLINK.EXE is on
your path.
Couldn’t get LE/LIDATA record buffer Librarian error
Command-line error. See the message Out of memory reading LE/LIDATA record from object module.
Couldn’t get procedure address from dll dll Linker error
The linker wasn’t able to get a procedure from the specified DLL. Check to make sure you have the correct version of the
DLL.
Couldn’t load dll dll Linker error
The linker wasn’t able to load the specified DLL. Check to make sure the DLL is on your path.
Cycle in include files: filename MAKE error
This error message is issued if a makefile includes itself in the make script.
Debug info switch ignored for .COM files Linker warning
Turbo C++ does not include debug information for .COM files.
Debug information enabled, but no debug information found in OBJs Linker warning
No part of the application was compiled with debug information, but you requested that debug information be turned
on in the link.
Debug information in module module will be ignored Linker warning
Object files compiled with debug information now have a version record. The major version of this record is higher than
what TLINK currently supports and TLINK did not generate debug information for the module in question.
Debugging information overflow; try fewer modules with debug info Linker error
Too many modules containing debugging information are included in the link. Recompile your program with fewer
modules marked for debug information. This message is generated when you have more than 64K of types or symbols
in a single .OBJ file, or if you get more than 64K modules, source files (including .h files), scopes, logical debug segments,
classes, or optimized variables in the link.
Declaration does not specify a tag or an identifier Compiler error
This declaration doesn’t declare anything. This might be a struct or union without a tag or a variable in the declaration.
C++ requires that something be declared.
Declaration is not allowed here Compiler error
Declarations cannot be used as the control statement for while, for, do, if, or switch statements.
Declaration missing ; Compiler error
Your source file contained a declaration that was not followed by a semicolon.
Declaration syntax error Compiler error
Your source file contained a declaration that was missing some symbol or had some extra symbol added to it.
Declaration terminated incorrectly Compiler error
A declaration has an extra or incorrect termination symbol, such as a semicolon placed after a function body. A C++
member function declared in a class with a semicolon between the header and the opening left brace also generates this
error.
Declaration was expected Compiler error
A declaration was expected here but not found. This is usually caused by a missing delimiter such as a comma,
semicolon, right parenthesis, or right brace.
Declare operator delete (void*) or (void*, size_t) Compiler error
Declare the operator delete with a single void* parameter or with a second parameter of type size_t. If you use the
second version, it will be used in preference to the first version. The global operator delete can be declared using the
single-parameter form only.
Declare operator delete[] (void*) or (void*, size_t) Compiler error
Declare the operator delete with one of the following:
A single void* parameter
A second parameter of type size_t
If you use the second version, it will be used in preference to the first version. The global operatordelete can be declared
using the single-parameter form only.

Appendix C, Error messages 235


Declare type type prior to use in prototype Compiler warning
When a function prototype refers to a structure type that has not previously been declared, the declaration inside the
prototype is not the same as a declaration outside the prototype. For example,
int func(struct s *ps);
struct s { /* ... */ };
Because there is no struct s in scope at the prototype for func, the type of parameter ps is a pointer to undefined struct s,
and is not the same as the struct s that is later declared. This results in warning and error messages about incompatible
types, which would be mysterious without this warning message. To fix the problem, you can move the declaration for
struct s ahead of any prototype that references it, or add the incomplete type declaration struct s; ahead of any
prototype that references struct s. If the function parameter is a struct, rather than a pointer to struct, the incomplete
declaration is not sufficient; you must then place the struct declaration ahead of the prototype.
Default argument value redeclared Compiler error
When a parameter of a C++ function is declared to have a default value, this value can’t be changed, redeclared, or
omitted in any other declaration for the same function.
Default argument value redeclared for parameter parameter Compiler error
When a parameter of a C++ function is declared to have a default value, this value cannot be changed, redeclared, or
omitted in any other declaration for the same function.
Default expression may not use local variables Compiler error
A default argument expression is not allowed to use any local variables or other parameters.
Default outside of switch Compiler error
The compiler encountered a default statement outside a switch statement. This is most commonly caused by
mismatched braces.
Default value missing Compiler error
When a C++ function declares a parameter with a default value, all of the following parameters must also have default
values. In this declaration, a parameter with a default value was followed by a parameter without a default value.
Default value missing following parameter parameter Compiler error
All parameters following the first parameter with a default value must also have defaults specified.
Define directive needs an identifier Compiler error
The first non-whitespace character after a #define must be an identifier. The compiler found some other character.
symbol defined in module module is duplicated Linker error
There is a conflict between two symbols (either public or communal). This usually means that a symbol is defined in two
modules. An error occurs if both are encountered in the .OBJ file(s), because TLINK doesn’t know which is valid. A
warning results if TLINK finds one of the duplicated symbols in a library and finds the other in an .OBJ file; in this case,
TLINK uses the one in the .OBJ file.
Delete array size missing ] Compiler error
The array specifier in an operator is missing a right bracket.
Destructor cannot be declared const or volatile Compiler error
A destructor has been declared as const and/or volatile, and this is not allowed.
Destructor cannot have a return type specification Compiler error
It is illegal to specify the return type for a destructor.
Destructor for class is not accessible Compiler error
The destructor for this C++ class is protected or private, and cannot be accessed here to destroy the class. If a class
destructor is private, the class cannot be destroyed, and thus can never be used. This is probably an error. A protected
destructor can be accessed only from derived classes. This is a useful way to ensure that no instance of a base class is
ever created, but only classes derived from it.
Destructor for class required in conditional expression Compiler error
If the compiler must create a temporary local variable in a conditional expression, it has no good place to call the
destructor, because the variable might or might not have been initialized. The temporary variable can be explicitly
created, as with classname (val, val), or implicitly created by some other code. Recast your code to eliminate this
temporary value.
Destructor name must match the class name Compiler error
In a C++ class, the tilde (~) introduces a declaration for the class destructor. The name of the destructor must be the same
as the class name. In your source file, the tilde (~) preceded some other name.

236 User’s Guide


Divide error Run-time error
You’ve tried to divide an integer by zero. You can trap this error with the signal function. Otherwise, Turbo C++ calls
abort and your program terminates.
Division by zero Compiler error
Your source file contained a division or remainder operator in a constant expression with a zero divisor.
Division by zero Compiler warning
A division or remainder operator expression had a literal zero as a divisor.
Division by zero MAKE error
A division or remainder operator in an !if statement has a zero divisor.
do statement must have while Compiler error
Your source file contained a do statement that was missing the closing while keyword.
filename does not exist—don’t know how to make it MAKE error
There is a nonexistent file name in the build sequence, and no rule exists that would allow the file name to be built.
DOS error, ax = number Linker error
This error occurs if a DOS call returned an unexpected error. The ax value printed is the resulting error code. This could
indicate a TLINK internal error or a DOS error. The only DOS calls TLINK makes in which this error could occur are
read, write, seek, and close.
DOSSEG directive ignored in module Linker warning
This warning indicates that the DOSSEG directive is no longer supported by the linker.
do-while statement missing ( Compiler error
In a do statement, the compiler found no left parenthesis after the while keyword.
do-while statement missing ) Compiler error
In a do statement, the compiler found no right parenthesis after the test expression.
do-while statement missing ; Compiler error
In a do statement test expression, the compiler found no semicolon after the right parenthesis.
DPMI programs must use the large memoy model Compiler error
The command-line compiler generates this messae when you’re attmepting to create a DPMI program; DPMI programs
require that you use the large memory model.
Duplicate case Compiler error
Each case of a switch statement must have a unique constant expression value.
filename (linenum): Duplicate external name in exports Linker warning
Two export functions listed in the EXPORTS section of a module definition file defined the same external name. For
example,
EXPORTS
AnyProc=MyProc1
AnyProc=MyProc2
Duplicate file %s in list, not added! Librarian error
When building a library module, you specified an object file more that once.
Duplicate handler for type1, already had type2 Compiler error
It’s illegal to specify two handlers for the same type.
filename (linenum): Duplicate internal name in exports Linker warning
Two export functions listed in the EXPORTS section of the module definition file defined the same internal name. For
example,
EXPORTS
AnyProc1=MyProc
AnyProc2=MyProc
filename (linenum): Duplicate internal name in imports Linker warning
Two import functions listed in the IMPORTS section of the module definition file defined the same internal name. For
example,

Appendix C, Error messages 237


IMPORTS
AnyProc=MyMod1.MyProc1
AnyProc=MyMod2.MyProc2
Duplicate ordinal for exports: string (ordval1) and string (ordval2) Linker error
Two exports have been found for the same symbol, but with differing ordinal values. You must use the same ordinal
value or remove one of the exports.
Empty LEDATA record in module module Linker warning
This warning can happen if the translator emits a data record containing data. If this should happen, report the
occurrence to the translator vendor; there should be no bad side effects from the record.
Enum syntax error Compiler error
An enum declaration did not contain a properly formed list of identifiers.
Error changing file buffer size Librarian error
The librarian is attempting to adjust the size of a buffer used while reading or writing a file, but there is not enough
memory. It is likely that quite a bit of system memory will have to be freed up to resolve this error.
Error directive: message Compiler error
The text of the #error directive being processed in the source file is displayed.
Error directive: message MAKE error
MAKE has processed an #error directive in the source file, and the text of the directive is displayed in the message.
Error opening filename Librarian error
librarian cannot open the specified file for some reason.
Error opening filename for output Librarian error
librarian cannot open the specified file for output. This is usually due to lack of disk space for the target library, or a
listing file. This error occurs when the target file exists but is marked as a read-only file.
Error renaming filename to filename Librarian error
The librarian builds a library into a temporary file and then renames the temporary file to the target library file name. If
there is an error, usually due to lack of disk space, this message is posted.
Error writing output file Compiler error
A DOS error that prevents Turbo C++ from writing an .OBJ, .EXE, or temporary file. Check the output directory and
make sure that this is a valid directory. Also check that there is enough free disk space.
_ _except or _ _finally expected following _ _try Compiler error
In C, a _ _try block must be followed by an _ _except or _ _finally handler block.
Exception handling not enabled Compiler error
A ‘try’ block was found with the exception handling disabled.
Exception handling variable may not be used here Compiler error
An attempt has been made to use one of the exception handling values that are restricted to particular exception
handling constructs, such as GetExceptionCode().
Exception specification not allowed here Compiler error
Function pointer type declarations are not allowed to contain exception specifications.
Explicit stacks are ignored for PE images Linker warning
Windows 32-bit applications are PE format applications, which do not have explicit stacks. The stack segment will be
linked into the image, but it will not be used as the application stack. Instead, the stack size parameter will be used to set
the stack size, and the operating system will allocate a stack for the application.
Export symbol is duplicated Linker warning
This warning occurs if two different symbols with the same name are exported by the use of_export. The linker cannot
determine which definition it should export, and therefore uses the first symbol.
Expression expected Compiler error
An expression was expected here, but the current symbol cannot begin an expression. This message can occur where the
controlling expression of an if or while clause is expected or where a variable is being initialized. It is often due to an
accidentally inserted or deleted symbol in the source code.

238 User’s Guide


Expression of scalar type expected Compiler error
The not (!), increment (++), and decrement (– –) operators require an expression of scalar type. Only types char, short,
int, long, enum, float, double, long double, and pointer types are allowed.
Expression syntax Compiler error
This is a catchall error message when the compiler parses an expression and encounters a serious error. This is most
commonly caused by two consecutive operators, mismatched or missing parentheses, or a missing semicolon on the
previous statement.
Expression syntax error in !if statement MAKE error
The expression in an !if statement is badly formed—it contains a mismatched parenthesis, an extra or missing operator,
or a missing or extra constant.
reason—extended dictionary not created Librarian warning
The librarian could not produce the extended dictionary because of the reason given in the warning message.
Extended dictionary not found in library library, extended dictionaries ignored Linker warning
The /E option for TLINK requires that all libraries in the link have extended dictionaries. When a library without an
extended dictionary is encountered during a link operation in which the /E option is specified, the linker abandons
extended dictionary processing and proceeds to link with a default link.
Extern variable cannot be initialized Compiler error
The storage class extern applied to a variable means that the variable is being declared but not defined here—no storage
is being allocated for it. Therefore, you can’t initialize the variable as part of the declaration.
Extern symbol was not qualified with _ _import in module module Linker warning
Windows 32-bit applications which reference imported symbols need to make indirections to get to the data. For calls,
this is handled automatically by the linker. For references to imported DATA, the compiler must generate an
indirection, or the application will function incorrectly. The compiler knows to generate the indirection when the
symbol is qualified with _ _import. If the linker sees a segment relative reference to a symbol that is imported, and if the
symbol was not qualified with _ _import, you will get this message.
Extra argument in template class name template Compiler error
A template class name specified too many actual values for its formal parameters.
Extra parameter in call Compiler error
A call to a function, via a pointer defined with a prototype, had too many arguments given.
Extra parameter in call to function Compiler error
A call to the named function (which was defined with a prototype) had too many arguments given in the call.
Failed to locate DPMI server (DPMI16BI.OVL) Compiler error
Failed to locate protected mode loader (DPMILOAD.EXE) Compiler error
Make sure that DPMI16BI.OVL and DPMILOAD.EXE are somewhere on your path or in the same directory as the
protected mode command-line tool you were attempting to use.
Failed read from filename Linker error
The linker was unable to read from the file.
Failed write to filename Linker error
The Linker was unable to write to the file.
_ _far16 may only be used with _ _pascal or _ _cdecl Compiler error
When you use _ _far16 to make calls to functions or reference data in a 16-bit DLL, such functions and data can be
modified only by _ _pascal or _ _cdecl.
File must contain at least one external declaration Compiler error
This compilation unit was logically empty, containing no external declarations. ANSI C and C++ require that something
be declared in the compilation unit.
Filename too long Compiler error
The file name given in an #include directive was too long for the compiler to process. Path names must be no longer
than 260 characters.
File name too long MAKE error
The path name in an !include directive overflowed MAKE’s internal buffer (512 bytes).
filename file not found Librarian warning
The command-line librarian attempted to add a nonexisting object but created the library anyway.

Appendix C, Error messages 239


filename file not found Librarian error
The IDE creates the library by first removing the existing library and then rebuilding. If any objects do not exist, the
library is considered incomplete and TLIB generates this error. If the IDE reports that an object does not exist, either the
source module has not been compiled or there were errors during compilation. Rebuilding your project should resolve
the problem or indicate where the errors have occurred.
filename (linenum): File read error Linker error
A DOS error occurred while TLINK read the module definition file. This usually means that a premature end of file
occurred.
Fixup to zero length segment in module module Linker error
A reference has been made past the end of an image segment. This reference would end up accessing an invalid address,
and has been flagged as an error.
Fixup overflow at address, target = address Linker warning
These messages indicate an incorrect data or code reference in an object file that TLINK must fix up at link time.
The cause is often a mismatch of memory models. A near call to a function in a different code segment is the most likely
cause. These errors can also result if you generate a near call to a data variable or a data reference to a function. In either
case the symbol named as the target in the error message is the referenced variable or function. The reference is in the
named module, so look in the source file of that module for the offending reference.
In an assembly language program, a fixup overflow frequently occurs if you have declared an external variable within a
segment definition, but this variable actually exists in a different segment.
If this technique does not identify the cause of the failure, or if you are programming in assembly language or in a high-
level language other than Turbo C++, there might be other possible causes for this message. Even in Turbo C++, this
message could be generated if you are using different segment or group names than the default values for a given
memory model.
Fixup to zero length segment in module module Linker error
This error usually occurs if you make a reference to a segment that doesn’t contain any data. If the segment isn’t
grouped with other segments, the result is a zero-length physical segment, which cannot exist. The linker therefore
cannot make a reference to it.
Floating point error: Divide by 0. Run-time error
Floating point error: Domain. Run-time error
Floating point error: Overflow. Run-time error
These fatal errors result from a floating-point operation for which the result is not finite.
“Divide by 0” means the result is +INF or -INF exactly, such as 1.0/0.0.
“Domain” means the result is NAN (not a number).
“Overflow” means the result is +INF (infinity) or -INF with complete loss of precision, such as assigning
1e200*1e200 to a double.
Floating point error: Partial loss of precision. Run-time error
Floating point error: Underflow. Run-time error
These exceptions are masked by default, and the error messages do not occur. Underflows are converted to zero and
losses of precision are ignored. They can be unmasked by calling _control87.
Floating point error: Stack fault. Run-time error
The floating-point stack has been overrun. This error does not normally occur and might be due to assembly code using
too many registers or to a misdeclaration of a floating-point function.
These floating-point errors can be avoided by masking the exception so that it doesn’t occur, or by catching the
exception with signal. See the functions _control87 and signal for details.
for statement missing ( Compiler error
In a for statement, the compiler found no left parenthesis after the for keyword.
for statement missing ) Compiler error
In a for statement, the compiler found no right parenthesis after the control expressions.
for statement missing ; Compiler error
In a for statement, the compiler found no semicolon after one of the expressions.
Friends must be functions or classes Compiler error
A friend of a C++ class must be a function or another class.

240 User’s Guide


Function call missing ) Compiler error
The function call argument list had some sort of syntax error, such as a missing or mismatched right parenthesis.
Function calls not supported Compiler error
In integrated debugger expression evaluation, calls to functions (including implicit conversion functions, constructors,
destructors, overloaded operators, and inline functions) are not supported.
Function defined inline after use as extern Compiler error
Functions cannot become inline after they have already been used. Either move the inline definition forward in the file
or delete it entirely.
Function definition cannot be a Typedef’ed declaration Compiler error
In ANSI C a function body cannot be defined using a typedef with a function Type.
Function function cannot be static Compiler error
Only ordinary member functions and the operators new and delete can be declared static. Constructors, destructors,
and other operators must not be static.
Function function should have a prototype Compiler error
A function was called with no prototype in scope.
In C, int foo(); is not a prototype, but int foo(int); is, and so is int foo(void);. In C++, int foo(); is a prototype, and
is the same as int foo(void);. In C, prototypes are recommended for all functions. In C++, prototypes are required for all
functions. In C and C++, a function definition (a function header with its body) serves as a prototype if it appears before
any other mention of the function.
Function should return a value Compiler warning
This function was declared (perhaps implicitly) to return a value. A return statement was found without a return value
or the end of the function was reached without a return statement being found. Either return a value or declare the
function as void.
Functions function1 and function2 both use the same dispatch number Compiler error
This error is the result of a dynamically dispatched virtual table (DDVT) problem. When you override a dynamically
dispatchable function in a derived class, use the same dispatch index. Each function within the same class hierarchy
must use a different dispatch index.
Functions cannot return arrays or functions Compiler error
A function cannot return an array or a function. Only pointers or references to arrays or functions can be returned.
Functions containing local destructors are not expanded inline in functionfunction Compiler warning
You’ve created an inline function for which Turbo C++ turns off inlining. You can ignore this warning if you like; the
function will be generated out of line.
Functions containing reserved word are not expanded inline Compiler warning
Functions containing any of the reserved words do, for, while, goto, switch, break, continue, and case cannot be
expanded inline, even when specified as inline. The function is still perfectly legal, but will be treated as an ordinary
static (not global) function.
Functions may not be part of a struct or union Compiler error
This C struct or union field was declared to be of type function rather than pointer to function. Functions as fields are
allowed only in C++.
Functions with exception specifications are not expanded inline Compiler warning
Check your inline code for lines containing exception specifications.
Functions with taking class-by-value argument(s) are not expanded inline Compiler warning
When exception handling is enabled, functions that take class arguments by value cannot be expanded inline (Note that
functions taking class parameters by reference are not subject to this restriction.)
General error Linker error
General error in library file filename in module module near module file offset 0xyyyyyyyy. Linker error
General error in module module near module file offset 0xyyyyyyyy Linker error
The linker gives as much information as possible about what processing was happening at the time of the unknown
fatal error. Call Technical Support with information about .OBJ or .LIB files.
Global anonymous union not static Compiler error
In C++, a global anonymous union at the file level must be static.

Appendix C, Error messages 241


Goto bypasses initialization of a local variable Compiler error
In C++ it is illegal to bypass the initialization of a local variable in any way. You’ll get this error when there is a goto that
tries to transfer control past this local variable.
Goto into an exception handler is not allowed Compiler error
It’s illegal to jump into a try block or an exception handler that’s attached to a try block.
Goto statement missing label Compiler error
The goto keyword must be followed by an identifier.
Group group exceeds 64K Linker error
A group exceeded 64K bytes when the segments of the group were combined.
Group overflowed maximum size: group Compiler error
The total size of the segments in a group (for example, DGROUP) exceeded 64K.
Group group1 overlaps group group2 Linker warning
This means that TLINK has encountered nested groups. This warning occurs only when overlays are used.
Handler for type1 hidden by previous handler for type2 Compiler warning
This warning is issued when a handler for a type D that is derived from type B is specified after a handler for B, since the
handler for D will never be invoked.
specifier has already been included Compiler error
This type specifier occurs more than once in this declaration. Delete or change one of the occurrences.
Hexadecimal value contains more than 3 digits Compiler warning
Under older versions of C, a hexadecimal escape sequence could contain no more than three digits. The ANSI standard
allows any number of digits to appear as long as the value fits in a byte. This warning results when you have a long
hexadecimal escape sequence with many leading zero digits (such as “\x00045”). Older versions of C would interpret
such a string differently.
function1 hides virtual function function2 Compiler warning
A virtual function in a base class is usually overridden by a declaration in a derived class. In this case, a declaration with
the same name but different argument types makes the virtual functions inaccessible to further derived classes.
Identifier expected Compiler error
An identifier was expected here, but not found. In C, this error occurs in a list of parameters in an old-style function
header, after the reserved words struct or union when the braces are not present, and as the name of a member in a
structure or union (except for bit fields of width 0). In C++, an identifier is also expected in a list of base classes from
which another class is derived, following a double colon (::), and after the reserved word operator when nooperator
symbol is present.
Identifier identifier cannot have a type qualifier Compiler error
A C++ qualifier class::identifier cannot be applied here. A qualifier is not allowed on typedef names, on function
declarations (except definitions at the file level), on local variables or parameters of functions, or on a class member
except to use its own class as a qualifier (which is redundant but legal).
If statement missing ( Compiler error
In an if statement, the compiler found no left parenthesis after the if keyword.
If statement missing ) Compiler error
In an if statement, the compiler found no right parenthesis after the test expression.
If statement too long MAKE error
Ifdef statement too long MAKE error
Ifndef statement too long MAKE error
An If, Ifdef, or Ifndef statement has exceeded 4,096 characters.
Ignored module, path is too long Librarian warning
The path to a specified .OBJ or .LIB file is greater than 64 characters. The max path to a file for librarian is 64 characters.
Illegal ACBP byte in SEGDEF Linker error
This is usually a translator error.
Illegal character character (0xvalue) Compiler error
The compiler encountered some invalid character in the input file. The hexadecimal value of the offending character is
printed. This can also be caused by extra parameters passed to a function macro.

242 User’s Guide


Illegal character in constant expression expression MAKE error
MAKE encountered a character not allowed in a constant expression. If the character is a letter, this probably indicates a
misspelled identifier.
Illegal component to GRPDEF Linker error
This is usually a translator error.
Illegal group definition: group Linker error
This error is caused by a malformed GRPDEF record in an .OBJ file. This could result from custom-built .OBJ files or a
bug in the translator used to generate the .OBJ file. If this occurs in a file created by Turbo C++, recompile the file. If the
error persists, contact Borland Technical Support.
Illegal initialization Compiler error
In C, initializations must be either a constant expression, or else the address of a global extern or static variable plus or
minus a constant.
Illegal local public in module Linker warning
The message occurs when the linker sees an LPUBDEF record with an offset of zero for a VIRDEF that resides in an
overlay segment. This can happen if you are trying to use structured exception support in an application that uses
overlays.
Illegal octal digit Compiler error
An octal constant containing a digit of 8 or 9 was found.
Illegal parameter to _ _emit_ _ Compiler error
You supplied an argument to _ _emit_ _ that is not a constant or an address.
Illegal pointer subtraction Compiler error
This is caused by attempting to subtract a pointer from a nonpointer.
Illegal structure operation Compiler error
In C or C++, structures can be used with dot (.), address-of (&), or assignment (=) operators, or can be passed to or from
functions as parameters. In C or C++, structures can also be used with overloaded operators. The compiler encountered
a structure being used with some other operator.
Illegal to take address of bit field Compiler error
It is not legal to take the address of a bit field, although you can take the address of other kinds of fields.
Illegal use of floating point Compiler error
Floating-point operands are not allowed in shift, bitwise Boolean, indirection (*), or certain other operators. The
compiler found a floating-point operand with one of these prohibited operators.
Illegal use of member pointer Compiler error
Pointers to class members can be used only with assignment, comparison, the .*, –>*, ?:, &&, and || operators, or
passed as arguments to functions. The compiler has encountered a member pointer being used with a different operator.
Illegal use of pointer Compiler error
Pointers can be used only with addition, subtraction, assignment, comparison, indirection (*) or arrow (–>) operators.
Your source file used a pointer with some other operator.
Ill-formed pragma Compiler warning
A pragma does not match one of the pragmas expected by the Turbo C++ compiler.
Image base address must be a multiple of 0x10000 Linker error
Based images must be aligned on 64k boundaries.
Images fixed at specific addresses typically will not run under Win32s Linker warning
Windows 32s loads all applications in a single address space. It’s impossible to predict where you application is going to
be loaded, because other 32-bit applications might have been loaded before yours. Fixed images must be loaded at their
requested base address or the loader will fail to run them.
Implicit conversion of type1 to type2 not allowed Compiler error
When a member function of a class is called using a pointer to a derived class, the pointer value must be implicitly
converted to point to the appropriate base class. In this case, such an implicit conversion is illegal.
Import symbol in module module clashes with prior module Librarian error
An import symbol can appear only once in a library file. A module that is being added to the library contains an import
that is already in a module of the library and it cannot be added again.

Appendix C, Error messages 243


Import library library encountered in obj list Linker error
Import libraries (import.lib) are not permitted in the OBJ file list. They must always appear in the LIB file list.
Improper use of typedef identifier Compiler error
Your source file used a typedef symbol where a variable should appear in an expression. Check for the declaration of
the symbol and possible misspellings.
Include files nested too deep Compiler error
When the compiler detects that header files are nested more than 1,000 levels deep, it assumes that the header file is
recursive, and stops compilation with this (fatal) error.
filename (linenum): Incompatible attribute Linker error
The linker encountered incompatible segment attributes in a CODE or DATA statement. For instance, both PRELOAD
and LOADONCALL can’t be attributes for the same segment.
Incompatible type conversion Compiler error
The cast requested can’t be done. Check the types.
Incorrect command-line argument: argument MAKE error
You’ve used incorrect command-line arguments.
Incorrect command-line option: option Compiler error
The compiler did not recognize the command-line parameter as legal.
Incorrect configuration file option: option Compiler error
The compiler did not recognize the configuration file parameter as legal; check for a preceding hyphen ().
Incorrect number format Compiler error
The compiler encountered a decimal point in a hexadecimal number.
Incorrect use of default Compiler error
The compiler found no colon after the default keyword in a case statement.
Incorrect version of RLINK32.DLL Linker error
The RLINK32.DLL used was not the correct version. Check to make sure you have the correct version of the DLL.
Initialization is only partially bracketed Compiler warning
When structures are initialized, nested pairs of braces can be used to mark the initialization of each member of the
structure. Bracketing the the members ensures that your idea and the compiler’s idea of the initializations are the same.
The compiler issues this warning when the brackets are not equally matched.
Initializing enumeration with type Compiler warning
You’re trying to initialize an enum variable to a different type. For example,
enum count { zero, one, two } x = 2;
results in this warning, because 2 is of type int, not type enum count. It is better programming practice to use an enum
identifier instead of a literal integer when assigning to or initializing enum types.
This error is reduced to a warning status to give existing programs a chance to compile.
Inline assembly not allowed Compiler error
Your source file contains inline assembly-language statements and you’re trying to compile it from within the integrated
environment. You must use BCC to compile source files that contain inline assembly.
Inline assembly not allowed in inline and template functions Compiler error
The compiler cannot handle inline assembly statements in a C++ inline or template function. You could eliminate the
inline assembly code or, in case of an inline function, make this a macro or remove the inline storage class.
int and string types compared MAKE error
You have tried to compare an integer operand with a string operand in an !if or !elif expression.
Internal compiler error Compiler error
An error occurred in the internal logic of the compiler. This error shouldn’t occur in practice, but it is listed here for
completeness in the event that a more specific error message is not generated.
Internal linker error errorcode Linker error
An error occurred in the internal logic of TLINK. This error shouldn’t occur in practice, but is listed here for
completeness in the event that a more specific error isn’t generated. If this error persists, write down the errorcode
number and contact Borland Technical Support.

244 User’s Guide


Invalid combination of opcode and operands Compiler error
The built-in assembler does not accept this combination of operands. Possible causes are the following:
There are too many or too few operands for this assembler opcode.
The number of operands is correct, but their types or order do not match the opcode; for example.
DEC 1, MOV AX, or MOV 1,AX. Try prefacing the operands with type overrides; for example MOV AX, WORD PTR foo.
Invalid entry at segment:offset. Application may not work in real mode Linker warning
This warning indicates that a necessary entry was missing from the entry table of your executable file. The application
may not work in real mode unless you fix the code and data.
Invalid entry point offset Linker error
This message occurs only when modules with 32-bit records are linked. It means that the initial program entry point
offset exceeds the DOS limit of 64K.
Invalid exe filename: filename Linker error
The exe filename had an incorrect extension, such as .OBJ, .MAP, .LIB, .DEF, or .RES.
Invalid extended dictionary in library library: extended dictionaries ignored Linker warning
The extended dictionary in the library is invalid. Run TLIB /E on the library.
Invalid indirection Compiler error
The indirection operator (*) requires a non-void pointer as the operand.
Invalid initial stack offset Linker error
This message occurs only when modules with 32-bit records are linked. It means that the initial stack pointer value
exceeds the DOS limit of 64K.
Invalid macro argument separator Compiler error
In a macro definition, arguments must be separated by commas. The compiler encountered some other character after
an argument name.
Invalid map filename: filename Linker error
The map filename had an incorrect extension, such as .OBJ, .EXE, .DLL, .LIB, .DEF, or .RES.
Invalid page size value ignored Librarian warning
Invalid page size is given. The page size must be a power of 2, and it cannot be smaller than 16 or larger than 32,768.
Invalid pointer addition Compiler error
Your source file attempted to add two pointers together.
Invalid register combination (e.g. [BP+BX]) Compiler error
The built-in assembler detected an illegal combination of registers in an instruction. Valid index register combinations
are [BX], [BP], [SI], [DI], [BX+SI], [BX+DI], [BP+SI], and [BP+DI]. Other index register combinations (such as [AX],
[BP+BX], and [SI+DX]) are not allowed.
Local variables (variables declared in procedures and functions) are usually allocated on the stack and accessed via the
BP register. The assembler automatically adds [BP] in references to such variables, so even though a construct like
Local[EBX] (where Local is a local variable) appears valid, it is not, because the final operand would become
Local[BP+EBX].
Invalid segment definition Linker error
The compiler produced a flawed object file. If this occurs in a file created by Turbo C++, recompile the file. If the
problem persists, contact Borland Technical Support.
Invalid size specified for segment alignment Linker error
This error occurs if an invalid value is specified for the Segment Alignment setting. The value specified must be an
integral multiple of 2 and less than 64K. Common values are 16 and 512. This error only occurs when linking Windows
applications.
Invalid size specified for segment packing Linker error
An non-decimal number was provided on the command line for the segment packing size limit.
Invalid target–>/T target Linker error
The command-line linker found an invalid target. Valid targets are ‘w’ and ‘d’.
Invalid template argument list Compiler error
In a template declaration, the keyword template must be followed by a list of formal arguments enclosed within the<
and > delimiters; an illegal template argument list was found.

Appendix C, Error messages 245


Invalid template qualified name template::name Compiler error
When defining a template class member, the actual arguments in the template class name that is used as the left operand
for the :: operator must match the formal arguments of the template class. For example:
template <class T> class X
{
void f();
};

template <class T> void X<T>::f(){}


The following would be illegal:
template <class T> void X<int>::f(){}
Invalid use of dot Compiler error
An identifier must immediately follow a period operator (.).
Invalid use of template template Compiler error
Outside of a template definition, it is illegal to use a template class name without specifying its actual arguments. For
example, you can use vector<int> but not vector.
Irreducible expression tree Compiler error
This is a sign of some form of compiler error. An expression on the indicated line of the source file has caused the code
generator to be unable to generate code. The offending expression should be avoided. Notify Borland Technical Support
if the compiler encounters this error.
base is an indirect virtual base class of class Compiler error
A pointer to a C++ member of the given virtual base class cannot be created; an attempt has been made to create such a
pointer (either directly or through a cast).
identifier is assigned a value that is never used Compiler warning
The variable appears in an assignment, but is never used anywhere else in the function just ending. The warning is
indicated only when the compiler encounters the closing brace.
identifier is declared as both external and static Compiler warning
This identifier appeared in a declaration that implicitly or explicitly marked it as global or external, and also in a static
declaration. The identifier is taken as static. You should review all declarations for this identifier.
identifier is declared but never used Compiler warning
Your source file declared the named variable as part of the block just ending, but the variable was never used. The
warning is indicated when the compiler encounters the closing brace of the compound statement or function. The
declaration of the variable occurs at the beginning of the compound statement or function.
constructor is not a base class of class Compiler error
A C++ class constructor class is trying to call a base class constructor constructor, or you are trying to change the access
rights of class::constructor. constructor is not a base class of class. Check your declarations.
identifier is not a member of struct Compiler error
You are trying to reference identifier as a member of struct, but it is not a member. Check your declarations.
identifier is not a non-static data member and can’t be initialized here Compiler error
Only data members can be initialized in the initializers of a constructor. This message means that the list includes a static
member or function member.
identifier is not a parameter Compiler error
In the parameter declaration section of an old-style function definition, identifier is declared but is not listed as a
parameter. Either remove the declaration or add identifier as a parameter.
type is not a polymorphic class type Compiler error
A dynamic_cast was used with a pointer to a class that was compiled with the –RT compiler option disabled.
identifier is not a public base class of classtype Compiler error
The right operand of a .*, –>*, or ::operator was not a pointer to a member of a class that is either identical to or an
unambiguous accessible base class of the left operand’s class type. The class of the member pointer must match (or be a
public base class of) the object operand.

246 User’s Guide


filename is not a valid library Linker warning
This error occurs if a file that wasn’t a valid library module was passed to the linker in the library section.
member is not a valid template type member Compiler error
A member of a template with some actual arguments that depend on the formal arguments of an enclosing template
was found not to be a member of the specified template in a particular instance.
member is not accessible Compiler error
You are trying to reference C++ class member member, but it is private or protected and cannot be referenced from this
function. This sometimes happens when attempting to call one accessible overloaded member function (or constructor),
but the arguments match an inaccessible function. The check for overload resolution is always made before checking for
accessibility. If this is the problem, try an explicit cast of one or more parameters to select the desired accessible function.
function is obsolete Compiler warning
The compiler generates this warning message when it encounters a function that is obsolete. Functions marked by this
error message will be removed from the next version of the product.
Last parameter of operator must have type int Compiler error
When a postfix operator++ or operator– – is declared, the last parameter must be declared with the type int.
Library contains COMDEF records—extended dictionary not created Librarian warning
An object record being added to a library contains a COMDEF record. This is not compatible with the extended
dictionary option.
Library too large, restart with library page size size Librarian error
The library being created could not be built with the current library page size.
Limit of 254 segments for new executable file exceeded Linker error
The new executable file format only allows for 254 segments. Examine the map file. Usually one of two things cause this
problem. If the application is large model, the code segment packing size could be so small that there are too many code
segments. Increasing the code segment packing size with the /P option could help. The other possibility is that you have
a lot of far data segments with only a few bytes of data in them. The map file will tell you if this is happening. In this
case, reduce the number of far data segments.
Linkage specification not allowed Compiler error
Linkage specifications such as extern “C” are allowed only at the file level. Move this function declaration out to the file
level.
Linker name conflict for function Compiler error
When the mangled name of a C++ inline function or a virtual table is too long and has to be truncated (this happens
most often with templates), and the truncated name matches a previously generated function or virtual table, this error
is issued by the compiler. The problem can be fixed by changing the name of the class or function, or by compiling with
the –Vs option.
Linker stack overflow Linker error
The linker uses a recursive procedure for marking modules to be included in an executable image from libraries. This
procedure can cause stack overflows in extreme circumstances. If you get this error message, remove some modules
from libraries, include them with the object files in the link, and try again.
Lvalue required Compiler error
The left hand side of an assignment operator must be an addressable expression. These include numeric or pointer
variables, structure field references or indirection through a pointer, or a subscripted array element.
Macro argument syntax error Compiler error
An argument in a macro definition must be an identifier. The compiler encountered some non-identifier character
where an argument was expected.
Macro expansion too long Compiler error
A macro cannot expand to more than 4,096 characters.
Macro expansion too long MAKE error
A macro cannot expand to more than 4,096 characters. This error often occurs if a macro recursively expands itself. A
macro cannot legally expand to itself.
Macro substitute text string is too long MAKE error
Macro replace text string is too long MAKE error
The macro substitution or replacement text string overflowed MAKE’s internal buffer of 512 bytes.

Appendix C, Error messages 247


main must have a return type of int Compiler error
In C++, function main has special requirements, one of which is that it cannot be declared with any return type other
than int.
Malformed command-line Compiler error
An invalid entry in the command line was found.
Matching base class function for function has different dispatch number. Compiler error
If a DDVT function is declared in a derived class, the matching base class function must have the same dispatch number
as the derived function.
Matching base class function for function is not dynamic Compiler error
If a DDVT function is declared in a derived class, the matching base class function must also be dynamic.
Maximum precision used for member pointer type type Compiler warning
When you use the –Vmd option, the compiler has to use the most general (and the least efficient) representation for that
member pointer type when it is declared and its class hasn’t been fully defined. This can cause less efficient code to be
generated (and make the member pointer type unnecessarily large), and can also cause problems with separate
compilation.
Member function must be called or its address taken Compiler error
When a member function is used in an expression, either it must be called or its address must be taken using the &
operator. In this case, a member function has been used in an illegal context.
Member identifier expected Compiler error
The name of a structure or C++ class member was expected here, but not found. The right side of a dot (.) or arrow (–>)
operator must be the name of a member in the structure or class on the left of the operator.
Member is ambiguous: member1 and member2 Compiler error
You must qualify the member reference with the appropriate base class name. In C++ class class, member member can be
found in more than one base class, and was not qualified to indicate which was meant. This happens only in multiple
inheritance, where the member name in each base class is not hidden by the same member name in a derived class on
the same path. The C++ language rules require that this test for ambiguity be made before checking for access rights
(private, protected, public). It is therefore possible to get this message even though only one (or none) of the members
can be accessed.
Member member cannot be used without an object Compiler error
This means that the user has written class::member where member is an ordinary (nonstatic) member, and there is no
class to associate with that member. For example, it is legal to write obj.class::member, but not to write class::member.
Member member has the same name as its class Compiler error
A static data member, enumerator, member of an anonymous union, or nested type cannot have the same name as its
class. Only a member function or a nonstatic member can have a name that is identical to its class.
Member member is initialized more than once Compiler error
In a C++ class constructor, the list of initializations following the constructor header includes the same member name
more than once.
Member pointer required on right side of .* or –>* Compiler error
The right side of a C++ dot-star (.*) or an arrow-star (–>*) operator must be declared as a pointer to a member of the class
specified by the left side of the operator. In this case, the right side is not a member pointer.
Memory full listing truncated! Librarian warning
The librarian has run out of memory creating a library listing file. A list file will be created but is not complete.
Memory reference expected Compiler error
The built-in assembler requires a memory reference. Most likely you have forgotten to put square brackets around an
index register operand; for example, MOV AX,BX+SI instead of MOV AX,[BX+SI].
Misplaced break Compiler error
The compiler encountered a break statement outside a switch or looping construct.
Misplaced continue Compiler error
The compiler encountered a continue statement outside a looping construct.
Misplaced decimal point Compiler error
The compiler encountered a decimal point in a floating-point constant as part of the exponent.

248 User’s Guide


Misplaced elif directive Compiler error
The compiler encountered an #elif directive without any matching #if, #ifdef, or #ifndef directive.
Misplaced elif statement MAKE error
An !elif directive is missing a matching !if directive.
Misplaced else Compiler error
The compiler encountered an else statement without a matching if statement. An extra else statement could cause this
message, but it could also be caused by an extra semicolon, missing braces, or some syntax error in a previous if
statement.
Misplaced else directive Compiler error
The compiler encountered an #else directive without any matching #if, #ifdef, or #ifndef directive.
Misplaced else statement MAKE error
An !else directive does not have a matching !if directive.
Misplaced endif directive Compiler error
The compiler encountered an #endif directive without a matching #if, #ifdef, or #ifndef directive.
Misplaced endif statement MAKE error
An !endif directive does have a matching !if directive.
filename (linenum): Missing internal name Linker error
In the IMPORTS section of the module definition file there was a reference to an entry specified via module name and
ordinal number. When an entry is specified by ordinal number an internal name must be assigned to this import
definition. Your program uses this internal name to refer to the imported definition. The syntax in the module definition
file should be
<internalname>=<modulename>.<ordinal>
Mixed common types in module module. Cannot mix COMDEFs and VIRDEFs. Linker error
You cannot mix both COMDEFs and VIRDEFs. Turn off the –Fc switch to stop generating COMDEFs, or turn on the
–Vs switch to stop generating VIRDEFs.
Mixing pointers to different ‘char’ types Compiler warning
You converted a signed char pointer to an unsigned char pointer, or vice versa, without using an explicit cast. (Strictly
speaking, this is incorrect, but it is often harmless.)
Multiple base classes require explicit class names Compiler error
In a C++ class constructor, each base class constructor call in the constructor header must include the base class name
when there is more than one immediate base class.
Multiple declaration for identifier Compiler error
This identifier was improperly declared more than once. This might be caused by conflicting declarations such asint a;
double a;, by a function declared two different ways, by a label repeated in the same function, or by some declaration
repeated other than an extern function or a simple variable (in C).
Multiple entry points defined Linker error
More than one entry point was defined for the application. You can only have one entry point.
identifier must be a member function Compiler error
Most C++ operator functions can be members of classes or ordinary nonmember functions, but certain ones are required
to be members of classes. These are operator =, operator –>, operator (), and type conversions. This operator function is
not a member function but should be.
identifier must be a member function or have a parameter of class type Compiler error
Most C++ operator functions must have an implicit or explicit parameter of class type. This operator function was
declared outside a class and does not have an explicit parameter of class type.
identifier must be a previously defined class or struct Compiler error
You are attempting to declare identifier to be a base class, but either it is not a class or it has not yet been fully defined.
Correct the name or rearrange the declarations.
identifier must be a previously defined enumeration tag Compiler error
This declaration is attempting to reference identifier as the tag of an enum type, but it has not been so declared. Correct
the name, or rearrange the declarations.

Appendix C, Error messages 249


identifier must be declared with no parameters Compiler error
This C++ operator function was incorrectly declared with parameters.
identifier must be declared with one parameter Compiler error
This C++ operator function was incorrectly declared with more than one parameter.
operator must be declared with one or no parameters Compiler error
When operator++ or operator – – is declared as a member function, it must be declared to take either no parameters (for
the prefix version of the operator) or one parameter of type int (for the postfix version).
operator must be declared with one or two parameters Compiler error
When operator++ or operator – – is declared as a nonmember function, it must be declared to take either one parameter
(for the prefix version of the operator) or two parameters (for the postfix version).
identifier must be declared with two parameters Compiler error
This C++ operator function was incorrectly declared with other than two parameters.
Must take address of a memory location Compiler error
Your source file used the address-of operator (&) with an expression that cannot be used that way; for example, a
register variable (in C).
Need an identifier to declare Compiler error
In this context, an identifier was expected to complete the declaration. This might be atypedef with no name, or an extra
semicolon at file level. In C++, it might be a class name improperly used as another kind of identifier.
‘new’ and ‘delete’ not supported IDE debugger error
The integrated debugger does not support the evaluation of ‘new’ and ‘delete’.
New executable header overflowed 64K Linker error
The size of all the components of the new executable header of a Windows application is greater than 64K. Usually this
is caused by a very large resident name table. If your application exports many functions, try exporting more of them by
ordinal value , rather than by name. See the /Gr and /Gn linker options, documented under “Advanced Linker” on
page 57 for more information.
No : following the ? Compiler error
The question mark (?) and colon (:) operators do not match in this expression. The colon might have been omitted, or
parentheses might be improperly nested or missing.
No automatic data segment Linker warning
No group named DGROUP was found. Because Borland’s initialization files define DGROUP, you will only see this
error if you don’t link with an initialization file and your program doesn’t define DGROUP. Windows uses DGROUP to
find the local data segment. The DGROUP is required for Windows applications (but not DLLs) unless DATA NONE is
specified in the module definition file.
No base class to initialize Compiler error
This C++ class constructor is trying to implicitly call a base class constructor, but this class was declared with no base
classes. Check your declarations.
No closing quote MAKE error
There is no closing quote for a string expression in a !if or !elif expression.
No declaration for function function Compiler warning
You called a function without first declaring that function. In C, you can declare a function without presenting a
prototype, as in int func();. In C++, every function declaration is also a prototype; this example is equivalent toint
func(void);. The declaration can be either classic or modern (prototype) style.
No module definition file specified; using defaults Linker warning
This warning occurs when you do not specify a .DEF file for the link.
No file name ending Compiler error
The file name in an #include statement was missing the correct closing quote or angle bracket.
No filename ending MAKE error
The file name in an !include statement is missing the correct closing quote or angle bracket.
No file names given Compiler error
The command line of the Turbo C++ command-line compiler (BCC) contained no file names. You must specify a source
file name.

250 User’s Guide


No internal name for IMPORT in .DEF file Linker error
The .DEF file has a semantic error. You probably forgot to put the internal name for an import before the module name.
For example,
IMPORTS
_foo.1
The proper syntax is
IMPORTS
_foo=mydll.1
No macro before = MAKE error
You must give a macro a name before you can assign it a value.
No match found for wildcard expression MAKE error
There are no files matching the wildcard expression for MAKE to expand. For example, if you write
prog.exe: *.obj
MAKE sends this error message if there are no files with the extension .OBJ in the current directory.
No output file specified Linker error
No EXE or DLL file was specified. Because the linker defaults to the first .OBJ name, this error is usually caused because
no object object files were included.
No program starting address defined Linker warning
This warning means that no module defined the initial starting address of the program. This is probably caused by
forgetting to link in the initialization module C0x.OBJ.
No stack Linker warning
This warning is issued if no stack segment is defined in any of the object files or in any of the libraries included in the
link. This is a normal message for the tiny memory model in Turbo C++, or for any application program that will be
converted to a .COM file. Except for DLLs, this indicates an error.
If a Turbo C++ program produces this message for any but the tiny memory model, make sure you are using the correct
C0x startup object files.
No stub for fixup at address Linker warning
This error occurs when the target for a fixup is in an overlay segment, but no stub is found for a target external. This is
usually the result of not making public a symbol in an overlay that is referenced from the same module.
No terminator specified for inline file operator MAKE error
The makefile contains either the && or << command-line operators to start an inline file, but the file is not terminated.
No type information IDE debugger error
The integrated debugger has no type information for this variable. Ensure that you’ve compiled the module with debug
information.
Non-const function function called for const object Compiler warning
A non-const member function was called for a const object. This is an error, but was reduced to a warning to give
existing programs a chance to work.
Nonportable pointer comparison Compiler warning
Your source file compared a pointer to a nonpointer other than the constant zero. You should use a cast to suppress this
warning if the comparison is proper.
Nonportable pointer conversion Compiler error
An implicit conversion between a pointer and an integral type is required, but the types are not the same size. This
cannot be done without an explicit cast. This conversion might not make any sense, so be sure this is what you want to
do.
Nonportable pointer conversion Compiler warning
A nonzero integral value is used in a context where a pointer is needed or where an integral value is needed; the sizes of
the integral type and pointer are the same. Use an explicit cast if this is what you really meant to do.
Nonresident Name Table is greater than 64K Linker warning
The maximum size of the Nonresident name table is 64K (in accordance with the industry-wide executable specification
standard). The linker continues with the link but ignores any subsequent Nonresident names encountered during
linking.

Appendix C, Error messages 251


Nontype template argument must be of scalar type Compiler error
A nontype formal template argument must have scalar type; it can have an integral, enumeration, or pointer type.
Non-ANSI Keyword Used: keyword Compiler error
A non-ANSI keyword (such as _ _fastcall) was used when strict ANSI conformance was requested via the –A option.
Non-virtual function function declared pure Compiler error
Only virtual functions can be declared pure, because derived classes must be able to override them.
Non-volatile function function called for volatile object Compiler warning
In C++, a class member function was called for a volatile object of the class type, but the function was not declared with
volatile following the function header. Only a volatile member function can be called for a volatile object.
filename not a MAKE MAKE error
The file you specified with the –f option is not a makefile.
Not a valid expression format type IDE debugger error
You used an invalid format specifier following an expression in the integrated debugger. A valid format specifier is a
repeat value (optional) followed by one of the following format specifiers: c, d, f[n], h, m, p, r, s, or x.
Not an allowed type Compiler error
Your source file declared some sort of forbidden type; for example, a function returning a function or array.
Not enough memory MAKE error
All your working storage has been exhausted.
Not enough memory to run application Linker error
There is not enough memory to run TLINK. Try reducing the size of any RAM disk or disk cache currently active. If
you’re running real mode, try using the MAKE –S option, or removing TSRs and network drivers.
Not enough memory for command-line buffer Librarian error
This error occurs when the librarian runs out of memory.
module not found in library Librarian warning
An attempt to perform either a ‘_’ or ‘*’ on a library has been made and the indicated object does not exist in the library.
Null pointer assignment Run-time error
When a small or medium memory model program exits, a check is made to determine if the contents of the first few
bytes within the program’s data segment have changed. These bytes would never be altered by a working program. If
they have been changed, the message Null pointer assignment is displayed to inform you that (most likely) a value was
stored to an uninitialized pointer. The program might appear to work properly in all other respects; however, this is a
serious bug which should be attended to immediately. Failure to correct an uninitialized pointer can lead to
unpredictable behavior (including locking the computer up in the large, compact, and huge memory models). You can
use the integrated debugger to track down null pointers.
Numeric constant too large Compiler error
String and character escape sequences larger than hexadecimal \xFF or octal \377 cannot be generated. Two-byte
character constants can be specified by using a second backslash. For example, \x0D\x0A represents a two-byte
constant A numeric literal following an escape sequence should be broken up like this:
printf("\x0D" '"12345");
This prints a carriage return followed by 12345.
Object module filename is invalid Librarian error
The librarian could not understand the header record of the object module being added to the library and has assumed
that it is an invalid module.
Objects of type type cannot be initialized with {} Compiler error
Ordinary C structures can be initialized with a set of values inside braces. C++ classes can be initialized with
constructors only if the class has constructors, private members, functions, or base classes that are virtual.
Old debug information in module module will be ignored Linker warning
Debug information in the .OBJ file is incompatible with this linker, and it will be ignored.
Only <<KEEP or <<NOKEEP MAKE error
You have specified something besides KEEP or NOKEEP when closing a temporary inline file.
Only member functions may be ‘const’ or ‘volatile’ Compiler error
Something other than a class member function has been declared const and/or volatile.

252 User’s Guide


Only one of a set of overloaded functions can be “C” Compiler error
C++ functions are by default overloaded, and the compiler assigns a new name to each function. If you want to override
the compiler’s assigning a new name by declaring the function extern “C”, you can do this for only one of a set of
functions with the same name. (Otherwise the linker would find more than one global function with the same name.)
Operand of delete must be non-const pointer Compiler error
It is illegal to delete a constant pointer value using operator delete.
Operator [ ] missing ] Compiler error
The C++ operator [ ] was declared as operator [. You must add the missing ] or otherwise fix the declaration.
Operator –> must return a pointer or a class Compiler error
The C++ operator –> function must be declared to either return a class or a pointer to a class (or struct or union). In
either case, it must be something to which the –> operator can be applied.
Operator delete must return void Compiler error
This C++ overloaded operator delete was declared in some other way.
Operator delete[] must return void Compiler error
This C++ overloaded operator delete was declared in some other way. Declare the delete with one of the following:
A single void* parameter
A second parameter of type size_t
If you use the second version, it will be used in preference to the first version. The global operatordelete can be declared
using the single-parameter form only.
Operator must be declared as function Compiler error
An overloaded operator was declared with something other than function type.
Operator new must have an initial parameter of type size_t Compiler error
Operator new can be declared with an arbitrary number of parameters, but it must always have at least one parameter
that specifies the amount of space to allocate.
Operator new[] must have an initial parameter of type size_t Compiler error
Operator new can be declared with an arbitrary number of parameters. It must always have at least one parameter that
specifies the amount of space to allocate.
Operator new must return an object of type void * Compiler error
The C++ overloaded operator new was declared another way.
Operator new[] must return an object of type void * Compiler error
This C++ overloaded operator new was declared another way.
Operators may not have default argument values Compiler error
It is illegal for overloaded operators to have default argument values.
Optimizer: Error reading input file Linker error
This message indicates a hardware error; reading from the device failed.
Optimizer: Error writing output file Linker error
This message indicates a hardware error, or a full disk drive; writing to the device failed.
Optimizer: File is not a new exe (NE format), optimization request ignored Linker warning
The 16-bit /Ox linker switches are validfor only 16-bit Windows and DMPI executibles.
Optimizer: Out of memory Linker error
There is not enough memory available to perform the linker optimizations.
Out of memory Compiler error
The total working storage is exhausted. Compile the file on a machine with more memory.
Out of memory Librarian error
For any number of reasons, the librarian or Turbo C++ ran out of memory while building the library. For many specific
cases a more detailed message is reported, leaving “Out of memory” to be the basic catchall for general low-memory
situations.
If you get this message because the public symbol tables have grown too large, you must free up memory. For the
command line this could involve removing TSRs or device drivers using real mode memory or close windows. In the
IDE, some additional memory can be gained by closing editors.

Appendix C, Error messages 253


Out of memory Linker error
The linker has run out of dynamically allocated memory needed during the link process. This error is a catchall for
running into a TLINK limit on memory usage. This usually means that too many modules, externals, groups, or
segments have been defined by the object files being linked together. You can try reducing the size of RAM disks and/or
disk caches that might be active.
Out of memory at library library: extended dictionaries ignored Linker warning
The linker ran out of memory allocating space to cache the extended dictionaries. The linker will ignore extended
dictionaries and proceed with the link.
Out of memory creating extended dictionary Librarian error
The librarian has run out of memory creating an extended dictionary for a library. The library is created but will not
have an extended dictionary.
Out of memory for block block Linker error
This error should not occur. If it does, call Borland Technical Support and give them the text of the message, including
the block name.
Out of memory reading LE/LIDATA record from object module Librarian error
The librarian is attempting to read a record of data from the object module, but it cannot get a large enough block of
memory. If the module that is being added has a large data segment or segments, it is possible that adding the module
before any other modules might resolve the problem. By adding the module first, there will be memory available for
holding public symbol and module lists later.
Out of space allocating per module debug struct Librarian error
The librarian ran out of memory while allocating space for the debug information associated with a particular object
module. Removing debugging information from some modules being added to the library might resolve the problem.
Output device is full Librarian error
Usually this error means that no space is left on the disk.
Overlays generated and no overlay manager included Linker warning
This warning is issued if overlays are created but the symbol _ _OVRTRAP_ _ is not defined in any of the object modules
or libraries linked in. The standard overlay library (OVERLAY.LIB) defines this symbol.
Overlays ignored in new executable image Linker warning
This error occurs if you attempt to link a Windows program with the /o option on. Windows executables can’t be
overlaid, although, with discardable code segments, you should be able to achieve a similar effect.
Overlays only supported in medium, large, and huge memory models Compiler error
Only programs using the medium, large, or huge memory models can be overlaid.
Overloadable operator expected Compiler error
Almost all C++ operators can be overloaded. The only ones that can’t be overloaded are the field-selection dot (.), dot-
star (.*), double colon (::), and conditional expression (?:). The preprocessor operators (# and ##) are not C or C++
language operators and thus cannot be overloaded. Other nonoperator punctuation, such as a semicolon (;) cannot be
overloaded.
Overloaded function name ambiguous in this context Compiler error
The only time an overloaded function name can be used without actually calling the function is when a variable or
parameter of an appropriate type is initialized or assigned. This error was issued because an overloaded function name
has been used in some other context.
Overloaded function resolution not supported IDE debugger error
The only time an overloaded function name can be used without actually calling the function is when a variable or
parameter if a appropriate type is initialized or assigned. In this case, an overloaded function name has been used in
some other context.
Overloaded prefix ‘operator operator’ used as a postfix operator Compiler warning
With the latest specification of C++, it is now possible to overload both the prefix and postfix versions of the++ and – –
operators. To allow older code to compile, Turbo C++ uses the prefix operator and issues this warning whenever only
the prefix operator is overloaded, but is used in a postfix context.
P1001 Unable to read file filename Help project error
The file specified in the project file is unreadable. This is a DOS file error.
P1003 Invalid path specified in Root option Help project error
The path specified by the Root option cannot be found. The compiler uses the current working directory.

254 User’s Guide


P1005 Path and filename exceed limit of 79 characters Help project error
The absolute path name, or the combined root and relative pathname, exceed the DOS limit of 79 characters. The file is
skipped.
P1007 Root path exceeds maximum limit of 66 characters Help project error
The specified root path name exceeds the DOS limit of 66 characters. The path name is ignored and the compiler uses
the current working directory.
P1009 [FILES] section missing Help project error
The [Files] section is required. The compilation is aborted.
P1011 Option optionname previously defined Help project error
The specified option was defined previously. The compiler ignores the attempted redefinition.
P1013 Project file extension cannot be .HLP Help project error
You cannot specify that the compiler use a project file with the .HLP extension. Normally, project files are given the .HPJ
extension.
P1015 Unexpected end-of-file Help project error
The compiler has unexpectedly come to the end of the project file. There might be an open comment in the project file or
an included file.
P1017 Parameter exceeds maximum length of 128 characters Help project error
An option, context name or number, build tag, or other parameter on the specified line exceeds the limit of 128
characters. The line is ignored.
P1021 Context number already used in [MAP] section Help project error
The context number on the specified line in the project file was previously mapped to a different context string. The line
is ignored.
P1023 Include statements nested too deeply Help project error
The #include statement on the specified line has exceeded the maximum of five include levels.
P1025 Section heading sectionname unrecognized Help project error
A section heading that is not supported by the compiler has been used. The line is skipped.
P1027 Bracket missing from section heading sectionname Help project error
The right bracket (]) is missing from the specified section heading. Insert the bracket and compile again.
P1029 Section heading missing Help project error
The section heading on the specified line is not complete. This error is also reported if the first entry in the project file is
not a section heading. The compiler continues with the next line.
P1030 Section sectionname previously defined Help project error
A duplicate section has been found in the project file. The lines under the duplicated section heading are ignored and the
compiler continues from the next valid section heading.
P1031 Maximum number of build tags exceeded Help project error
The maximum number of build tags that can be defined is 30. The excess tags are ignored.
P1033 Duplicate build tag in [BUILDTAGS] section Help project error
A build tag in the [BUILDTAGS] section has been repeated unnecessarily
P1035 Build tag length exceeds maximum Help project error
The build tag on the specified line exceeds the maximum of 32 characters. The compiler skips this entry.
P1037 Build tag tagname contains invalid characters Help project error
Build tags can contain only alphanumeric characters or the underscore (_) character. The line is skipped.
P1039 [BUILDTAGS] section missing Help project error
The BUILD option declared a conditional build, but there is no [BuildTags] section in the project file. All topics are
included in the build.
P1043 Too many tags in Build expression Help project error
The Build expression on the specified line has used more than the maximum of 20 build tags. The compiler ignores the
line.
P1045 [ALIAS] section found after [MAP] section Help project error
When used, the [Alias] section must precede the [Map] section in the project file. The [Alias] section is skipped
otherwise.

Appendix C, Error messages 255


P1047 Context string contextname already assigned an alias Help project error
You cannot do: a=b then a=c<_>(A context string can only have one alias.)
The specified context string has previously been aliased in the [Alias] section. The attempted reassignment on this line is
ignored.
P1049 Alias string aliasname already assigned Help project error
You cannot do: a=b then b=c
An alias string cannot, in turn, be assigned another alias.
P1051 Context string contextname cannot be used as alias string Help project error
You cannot do: a=b then c=a
A context string that has been assigned an alias cannot be used later as an alias for another context string.
P1053 Maximum number of font ranges exceeded Help project error
The maximum number of font ranges that can be specified is five. The rest are ignored.
P1055 Current font range overlaps previously defined range Help project error
A font size range overlaps a previously defined mapping. Adjust either font range to remove any overlaps. The second
mapping is ignored.
P1056 Unrecognized font name in Forcefont option Help project error
A font name not supported by the compiler has been encountered. The font name is ignored and the compiler uses the
default Helvetica font.
P1057 Font name too long Help project error
Font names cannot exceed 20 characters. The font is ignored.
P1059 Invalid multiple-key syntax Help project error
The syntax used with a MULTIKEY option is unrecognized.
P1061 Character already used Help project error
The specified keywordtable identifier is already in use. Choose another character.
P1063 Characters ‘K’ and ‘k’ cannot be used Help project error
These characters are reserved for Help’s normal keyword table. Choose another character.
P1065 Maximum number of keyword tables exceeded Help project error
The limit of five keyword tables has been exceeded. Reduce the number. The excess tables are ignored.
P1067 Equal sign missing Help project error
An option is missing its required equal sign on the specified line. Check the syntax for the option.
P1069 Context string missing Help project error
The line specified is missing a context string before an equal sign.
P1071 Incomplete line in sectionname section Help project error
The entry on the specified line is not complete. The line is skipped.
P1073 Unrecognized option in [OPTIONS] section Help project error
An option has been used that is not supported by the compiler. The line is skipped.
P1075 Invalid build expression Help project error
The syntax used in the build expression on the specified line contains one or more logical or syntax errors.
P1077 Warning level must be 1, 2, or 3 Help project error
The WARNING reporting level can only be set to 1, 2, or 3. The compiler will default to full reporting (level 3).
P1079 Invalid compression option Help project error
The COMPRESS option can only be set to TRUE or FALSE. The compilation continues without compression.
P1081 Invalid title string Help project error
The TITLE option defines a string that is null or contains more than 32 characters. The title is truncated.
P1083 Invalid context identification number Help project error
The context number on the specified line is null or contains invalid characters.
P1085 Unrecognized text Help project error
The unrecognizable text that follows valid text in the specified line is ignored.

256 User’s Guide


P1086 Invalid font-range syntax Help project error
The font-range definition on the specified line contains invalid syntax. The compiler ignores the line. Check the syntax
for the MAPFONTSIZE option.
P1089 Unrecognized sort ordering Help project error
You have specified an ordering that is not supported by the compiler. Contact Borland Technical Support for
clarification of the error.
Parameter names are used only with a function body Compiler error
When declaring a function (not defining it with a function body), you must use either empty parentheses or a function
prototype. A list of parameter names only is not allowed.
Example declarations include
int func(); // declaration without prototype--OK
int func(int, int); // declaration with prototype--OK
int func(int i, int j); // parameter names in prototype--OK
int func(i, j); // parameter names only--illegal
Parameter number missing name Compiler error
In a function definition header, this parameter consisted only of a type specifier number with no parameter name. This is
not legal in C. (It is allowed in C++, but there’s no way to refer to the parameter in the function.)
Parameter parameter is never used Compiler warning
The named parameter, declared in the function, was never used in the body of the function. This might or might not be
an error and is often caused by misspelling the parameter. This warning can also occur if the identifier is redeclared as
an automatic (local) variable in the body of the function. The parameter is masked by the automatic variable and
remains unused.
path - path is too long Librarian error
This error occurs when the length of any of the library file or module file’s path is greater than 64 characters.
Pointer to structure required on left side of –> or –>* Compiler error
Nothing but a pointer is allowed on the left side of the arrow (–>) in C or C++. In C++ a –>* operator is allowed.
Possible reference to undefined extern xxxx::i in module module Linker warning
Static data member has been declared but not defined in your application.
Possible unresolved external sym referenced from module mod Linker warning
This warning appears only for static data members of classes that have been declared but not defined.
Possible use of identifier before definition Compiler warning
Your source file used the named variable in an expression before it was assigned a value. The compiler uses a simple
scan of the program to determine this condition. If the use of a variable occurs physically before any assignment, this
warning will be generated. Of course, the actual flow of the program might assign the value before the program uses it.
Possibly incorrect assignment Compiler warning
This warning is generated when the compiler encounters an assignment operator as the main operator of a conditional
expression (that is, as part of an if, while or do-while statement). More often than not, this is a typographical error for
the equality operator. If you want to suppress this warning, enclose the assignment in parentheses and compare the
whole thing to zero explicitly. Thus,
if (a = b) ...
should be rewritten as
if ((a = b) != 0) ...
Program entry point may not reside in an overlay Linker error
Although almost all of an application can be overlaid, the initial starting address cannot reside in an overlay. This error
usually means that an attempt was made to overlay the initialization module (C0x.OBJ, for instance) by specifying the /o
option before the startup module.
Public symbol in module module1 clashes with prior module module2 Librarian error
A public symbol can appear only once in a library file. A module that is being added to the library contains a public
symbol that is already in a module of the library and cannot be added. The command-line message reports themodule2
name.

Appendix C, Error messages 257


Public symbol in module filename clashes with prior module Librarian error
A public symbol can appear only once in a library file. A module that is being added to the library contains a public
symbol that is already in a module of the library and cannot be added.
R2001 Unable to open bitmap file filename Help RTF error
The specified bitmap file is unreadable. This is a DOS file error.
R2003 Unable to include bitmap file filename Help RTF error
The specified bitmap file could not be found or is unreadable. This is a DOS file error or an out-of-memory condition.
R2005 Disk full Help RTF error
The Help resource file could not be written to disk. Create more space on the destination drive.
R2009 Cannot use reserved DOS device name for file filename Help RTF error
A file has been referred to as COM1, LPT2, PRN, and so on. Rename the file.
R2013 Output file filename already exists as a directory Help RTF error
There is a subdirectory in the Help project root with the same name as the desired Help resource file. Move or rename
the subdirectory.
R2015 Output file filename already exists as read-only Help RTF error
The specified filename cannot be overwritten by the Help resource file because the file has a read-only attribute. Rename
the project file or change the file’s attribute.
R2017 Path for file filename exceeds limit of 79 characters Help RTF error
The absolute path name, or the combined root and relative path name, to the specified file exceed the DOS limit of 79
characters. The file is ignored.
R2019 Cannot open file filename Help RTF error
The specified file is unreadable. This is a DOS file error.
R2021 Cannot find file filename Help RTF error
The specified file could not be found or is unreadable. This is a DOS file error or an out-of-memory condition.
R2023 Not enough memory to build Help file Help RTF error
To free up memory, unload any unneeded applications, device drivers, and memory-resident programs.
R2025 File environment error Help RTF error
The compiler has insufficient available file handles to continue. Increase the values for FILES= and BUFFERS= in your
CONFIG.SYS file and reboot.
R2027 Build tag tagname not defined in [BUILDTAGS] section of project file Help RTF error
The specified build tag has been assigned to a topic, but not declared in the project file. The tag is ignored for the topic.
R2033 Context string in Map section not defined in any topic Help RTF error
There are one or more context strings defined in the project file that the compiler could not find topics for.
R2035 Build expression missing from project file Help RTF error
The topics have build tags, but there is no Build= expression in the project file. The compiler includes all topics in the
build.
R2037 File filename cannot be created, due to previous error(s) Help RTF error
The Help resource file could not be created because the compiler has no topics remaining to be processed. Correct the
errors that preceded this error and recompile.
R2039 Unrecognized table formatting in topic topicnumber of file filename Help RTF error
The compiler ignores table formatting that is unsupported in Help. Reformat the entries as linear text if possible.
R2041 Jump context_string unresolved in topic topicnumber of file filename Help RTF error
The specified topic contains a context string that identifies a nonexistent topic. Check spelling, and that the desired topic
is included in the build.
R2043 Hotspot text cannot spread over paragraphs Help RTF error
A jump term spans two paragraphs. Remove the formatting from the paragraph mark.
R2045 Maximum number of tab stops reached in topic topicnumber of file filename Help RTF error
The limit of 32 tab stops has been exceeded in the specified topic. The default stops are used after the 32nd tab.
R2047 File filename not created Help RTF error
There are no topics to compile, or the build expression is false for all topics. There is no Help resource file created.

258 User’s Guide


R2049 Context string text too long in topic topicnumber of file filename Help RTF error
Context string hidden text cannot exceed 64 characters. The string is ignored.
R2051 File filename is not a valid RTF topic file Help RTF error
The specified file is not an RTF file. Check that you have saved the topic as RTF from your word processor.
R2053 Font fontname in file filename not in RTF font table Help RTF error
A font not defined in the RTF header has been entered into the topic. The compiler uses the default system font.
R2055 File filename is not a usable RTF topic file Help RTF error
The specified file contains a valid RTF header, but the content is not RTF or is corrupted.
R2057 Unrecognized graphic format in topic topicnumber of file filename Help RTF error
The compiler supports only Windows bitmaps. Check that metafiles or Macintosh formats have not been used. The
graphic is ignored.
R2059 Context string identifier already defined in topic topicnumber of file filename Help RTF error
There is more than one context-string identifier footnote for the specified topic. The compiler uses the identifier defined
in the first # footnote.
R2061 Context string contextname already used in file filename Help RTF error
The specified context string was previously assigned to another topic. The compiler ignores the latter string and the
topic has no identifier.
R2063 Invalid context-string identifier for topic topicnumber of file filename Help RTF error
The context-string footnote contains nonalphanumeric characters or is null. The topic is not assigned an identifier.
R2065 Context string defined for index topic is unresolved Help RTF error
The index topic defined in the project file could not be found. The compiler uses the first topic in the build as the index.
R2067 Footnote text too long in topic topicnumber of file filename Help RTF error
Footnote text cannot exceed the limit of 1000 characters. The footnote is ignored.
R2069 Build tag footnote not at beginning of topic topicnumber of file filename Help RTF error
The specified topic contains a build tag footnote that is not the first character in the topic. The topic is not assigned a
build tag.
R2071 Footnote text missing in topic topicnumber of file filename Help RTF error
The specified topic contains a footnote that has no characters.
R2073 Keyword string is null in topic topicnumber of file filename Help RTF error
A keyword footnote exists for the specified topic, but contains no characters.
R2075 Keyword string too long in topic topicnumber of file filename Help RTF error
The text in the keyword footnote in the specified topic exceeds the limit of 255 characters. The excess characters are
ignored.
R2077 Keyword(s) defined without title in topic topicnumber of file filename Help RTF error
Keyword(s) have been defined for the specified topic, but the topic has no title assigned. Search Topics Found displays
Untitled Topic<< for the topic.
R2079 Browse sequence string is null in topic topicnumber of file filename Help RTF error
The browse-sequence footnote for the specified topic contains no sequence characters.
R2081 Browse sequence string too long in topic topicnumber of file filename Help RTF error
The browse-sequence footnote for the specified topic exceeds the limit of 128 characters. The sequence is ignored.
R2083 Missing sequence number in topic topicnumber of file filename Help RTF error
A browse-sequence number ends in a colon (:) for the specified topic. Remove the colon, or enter a “minor” sequence
number.
R2085 Sequence number already defined in topic topicnumber of file filename Help RTF error
There is already a browse-sequence footnote for the specified topic. The latter sequence is ignored.
R2087 Build tag too long Help RTF error
A build tag for the specified topic exceeds the maximum of 32 characters. The tag is ignored for the topic.
R2089 Title string null in topic topicnumber of file filename Help RTF error
The title footnote for the specified topic contains no characters. The topic is not assigned a title.

Appendix C, Error messages 259


R2091 Title too long in topic topicnumber of file filename Help RTF error
The title for the specified topic exceeds the limit of 128 characters. The excess characters are ignored.
R2093 Title titlename in topic topicnumber of file filename used previously Help RTF error
The specified title has previously been assigned to another topic.
R2095 Title defined more than once in topic topicnumber of file filename Help RTF error
There is more than one title footnote in the specified topic. The compiler uses the first title string.
R2501 Using old key-phrase table Help RTF error
Maximum compression can only result by deleting the .PH file before each recompilation of the Help topics.
R2503 Out of memory during text compression Help RTF error
The compiler encountered a memory limitation during compression. Compilation continues with the Help resource file
not compressed. Unload any unneeded applications, device drivers, and memory-resident programs.
R2505 File environment error during text compression Help RTF error
The compiler has insufficient available file handles for compression. Compilation continues with the Help resource file
not compressed. Increase the values for FILES= and BUFFERS= in your CONFIG.SYS file and reboot.
R2507 DOS file error during text compression Help RTF error
The compiler encountered a problem accessing a disk file during compression. Compilation continues with the Help
resource file not compressed.
R2509 Error during text compression Help RTF error
One of the three compression errors—R2503, R2505, or R2507—has occurred. Compilation continues with the Help
resource file not compressed.
R2701 Internal error Help RTF error
R2703 Internal error Help RTF error
R2705 Internal error Help RTF error
R2707 Internal error Help RTF error
R2709 Internal error Help RTF error
Contact Borland Technical Support for clarification of the error.
Record kind num found, expected theadr or lheadr in module filename Librarian error
The librarian could not understand the header record of the object module being added to the library and has assumed
that it is an invalid module.
Record length len exceeds available buffer in module module Librarian error
This error occurs when the record length len exceeds the available buffer to load the buffer in module module. This occurs
when librarian runs out of dynamic memory.
Record type type found, expected theadr or lheadr in module Librarian error
The librarian encountered an unexpected type type instead of the expected THEADR or LHEADER record in module
module.
Recursive template function: class instantiated as class Compiler error
The compiler has detected a recursive template function instance. For example,
template<class T> void f(t x)
{
f((T*)0); //recursive template function!
}

void main()
{
f(0);
}
The compiler issues an error message for each nesting of the recursive instantiation; it’s usually obvious where the
recursion has occurred. To fix a recursive template, either change the dependencies, or provide a specialized version that
stops the recursion. For example, adding the following function definiton to removes the endless recursion:

260 User’s Guide


void f(int **)
{
}
Redefinition of macro is not identical Compiler warning
Your source file redefined the named macro using text that was not exactly the same as the first definition of the macro.
The new text replaces the old.
Redefinition of target filename MAKE error
The named file occurs on the left side of more than one explicit rule.
Reference initialized with type1, needs lvalue of type type2 Compiler error
A reference variable or parameter that is not declared constant must be initialized with an lvalue of the appropriate type.
This error was issued either because the initializer wasn’t an lvalue or because its type didn’t match the reference being
initialized.
Reference member member in class without constructors Compiler error
A class that contains reference members must have at least one user-defined constructor; otherwise, there would be no
way to initialize such members.
Reference member member initialized with a non-reference parameter Compiler error
An attempt has been made to bind a reference member to a parameter in a constructor. Because the parameter object
ceases to exist the moment the constructor returns, the reference member is then left referring to an undefined object.
(This is a common mistake that causes crashes and erratic program behavior.)
Reference member member is not initialized Compiler error
References must always be initialized. A class member of reference type must have an initializer provided in all
constructors for that class. This means that you cannot depend on the compiler to generate constructors for such a class,
because it has no way of knowing how to initialize the references.
Reference member member needs a temporary for initialization Compiler error
You provided an initial value for a reference type that was not an lvalue of the referenced type. This requires the
compiler to create a temporary for the initialization. Because there is no obvious place to store this temporary, the
initialization is illegal.
Reference variable variable must be initialized Compiler error
This C++ object is declared as a reference but is not initialized. All references must be initialized at their point of
declaration.
Register allocation failure Compiler error
This is a sign of some form of compiler error. Some expression in the indicated function was so complicated that the
code generator could not generate code for it. Try to simplify the offending function. Notify Borland Technical Support
if the compiler encounters this error.
Relocation item exceeds 1MB DOS limit Linker error
The DOS executable file format doesn’t support relocation items for locations exceeding 1MB. Although DOS could
never load an image this big, DOS extenders can, and thus TLINK supports generating images greater than DOS could
load. Even if the image is loaded with a DOS extender, the DOS executable file format is limited to describing relocation
items in the first 1MB of the image.
Relocation offset overflow Linker error
This error occurs only for 32-bit object modules and indicates a relocation (segment fixup) offset greater than the DOS
limit of 64K.
Relocation table overflow Linker error
This error occurs only for 32-bit object modules. The file being linked contains more base fixups than the standard DOS
relocation table can hold (base fixups are created mostly by calls to far functions).
Repeat count needs an lvalue IDE debugger error
The expression before the comma in the Watch or Evaluate window must be a manipulable region of storage. For
example, expressions like these are not valid:
i++, 10d
x = y, 10m

Appendix C, Error messages 261


Resident Name Table is greater than 64K Linker warning
The maximum size of the Resident name table is 64K (in accordance with the industry-wide executable specification
standard). The linker continues with the link but ignores any subsequent Resident names encountered during linking.
Resource binding failed Linker error
While you were linking from the command line, RLINK.EXE reported an error while binding resources to your image.
Restarting compile using assembly Compiler warning
The compiler encountered an ASM with an accompanying –B command-line option or #pragma inline statement. The
compile restarts using assembly language capabilities.
Results are safe in file filename Librarian warning
The librarian has successfully built the library into a temporary file, but cannot rename the file to the desired library
name. The temporary file will not be removed (so that the library can be preserved).
Rule line too long MAKE error
An implicit or explicit rule was longer than 4096 characters.
Segment alignment factor too small Linker error
This error occurs if the segment alignment factor is too small to represent the file addresses of the segments in the .EXE
file. This error only occurs when linking for Windows. See the documentation for the /A option.
Segment segment exceeds 64K Linker error
This message occurs if too much data is defined for a given data or code segment when TLINK combines segments with
the same name from different source files.
Segment segment is in two groups: group1 and group2 Linker warning
The linker found conflicting claims by the two named groups. Usually, this happens only in assembly language
programs. It means that two modules assigned the segment to two different groups.
Segment segment relocation data exceeds 64K Linker error
The NE format only allows for 8192 relocations per segment.
Segment too large for segment table Linker error
This error should never occur in practice. It means that a segment was bigger than 64K and its size cannot be
represented in the executable file. This error can only occur when linking for Windows; the format of the executable file
used for Windows does not support segments greater than 64K.
Self relative fixup overflowed in module module Linker warning
This message appears if a self-relative reference (usually a call) is made from one physical segment to another. It usually
happens only when employing assembler code, but can occur if you use the segment-naming options in the compiler. If
the reference is from one code segment to another, you are safe. If, however, the reference is from a code segment to a
data segment, you have probably made a mistake in some assembler code.
Side effects are not allowed IDE debugger error
Side effects such as assignments, ++, or – – are not allowed in the debugger watch window. A common error is to use “x
= y” (not allowed) instead of “x == y” to test the equality of “x” and “y.”
Size of identifier is unknown or zero Compiler error
This identifier was used in a context where its size was needed. For example, a struct tag might only be declared (with
the struct not defined yet), or an extern array might be declared without a size. If so, it’s illegal to have references to such
an item (like sizeof) or to dereference a pointer to this type. Rearrange your declaration so that the size of identifier is
available.
sizeof may not be applied to a bit field Compiler error
sizeof returns the size of a data object in bytes, which does not apply to a bit field.
sizeof may not be applied to a function Compiler error
sizeof can be applied only to data objects, not functions. You can request the size of a pointer to a function.
Size of the type is unknown or zero Compiler error
This type was used in a context where its size was needed. For example, a struct tag might only be declared (with the
struct not defined yet). If so, it’s illegal to have references to such an item (like sizeof) or to dereference a pointer to this
type. Rearrange your declarations so that the size of this type is available.
identifier specifies multiple or duplicate access Compiler error
A base class can be declared public or private, but not both. This access specifier can appear no more than once for a
base class.

262 User’s Guide


Stack overflow Run-time error
The default stack size for Turbo C++ programs is 5120 bytes. This should be enough for most programs, but those which
execute recursive functions or store a great deal of local data can overflow the stack. You will get this message only if
you have stack checking enabled. If you do get this message, you can try increasing the stack size or decreasing your
program’s dependence on the stack. Change the stack size by altering the global variable _stklen. Try switching to a
larger memory model to fit the larger stack.
To decrease the amount of local data used by a function, look at the example below. The variable buffer has been
declared static and does not consume stack space like list does.
void anyfunction(void) {
static int buffer[2000]; /* resides in the data segment */
int list[2000]; /* resides on the stack */
}
There are two disadvantages to declaring local variables as static.
1) It now takes permanent space away from global variables and the heap. This is usually only a minor disadvantage.
2) The function can no longer be reentrant. If the function is called recursively or asynchronously and it is important that
each call to the function have its own unique copy of the variable, you cannot make it static. This is because every time
the function is called, it will use the same exact memory space for the variable, rather than allocating new space for it on
each call. You could have a sharing problem if the function is trying to execute from within itself (recursively) or at the
same time as itself (asynchronously). For most DOS programs this is not a problem.
Stack size is less than 1400h. It has been reset to 1400h. Linker warning
Windows 3.0 requires the stack size of an application to be at least 1400h. If the automatic data segment (ADS) is near
64K, but your stack is less than 1400h, this can cause the ADS to overflow at load time, but not at link time. For a
Windows application, to protect against this, the linker forces the stack size to be at least 1400h.
Statement missing ; Compiler error
The compiler encountered an expression statement without a semicolon following it.
Storage class storage class is not allowed here Compiler error
The given storage class is not allowed here. Probably two storage classes were specified, and only one can be given.
String type not allowed with this operand MAKE error
You have tried to use an operand that is not allowed for comparing string types. Valid operands are ==, !=, <, >, <=, and
>=.
Structure passed by value Compiler warning
A structure was passed by value as an argument to a function without a prototype. It is a frequent programming
mistake to leave an address-of operator (&) off a structure when passing it as an argument. Because structures can be
passed by value, this omission is acceptable. This warning provides a way for the compiler to warn you of this mistake.
Structure required on left side of . or .* Compiler error
The left side of a dot (.) operator (or C++ dot-star operator) must evaluate to a structure type. In this case it did not.
Structure size too large Compiler error
Your source file declared a structure larger than 64K.
Stub program exceeds 64K Linker error
This error occurs if a DOS stub program written for Windows application exceeds 64K. Stub programs are specified via
the STUB module definition file statement. The linker only supports stub programs up to 64K.
Style of function definition is now obsolete Compiler warning
In C++, this old C style of function definition is illegal:
int func(p1, p2)
int p1, p2;
{...}
Subscripting missing ] Compiler error
The compiler encountered a subscripting expression that was missing its closing bracket. This could be caused by a
missing or extra operator, or by mismatched parentheses.
Superfluous & with function Compiler warning
An address-of operator (&) is not needed with function name; any such operators are discarded.

Appendix C, Error messages 263


Suspicious pointer conversion Compiler warning
The compiler encountered some conversion of a pointer that caused the pointer to point to a different type. You should
use a cast to suppress this warning if the conversion is proper.
Switch selection expression must be of integral type Compiler error
The selection expression in parentheses in a switch statement must evaluate to an integral type (char, short, int, long,
enum). You might be able to use an explicit cast to satisfy this requirement.
Switch statement missing ( Compiler error
In a switch statement, the compiler found no left parenthesis after the switch keyword.
Switch statement missing ) Compiler error
In a switch statement, the compiler found no right parenthesis after the test expression.
filename (linenum): Syntax error Linker error
The linker found a syntax error in the module definition file. The file name and line number tell you where the syntax
error occurred.
Table limit exceeded Linker error
One of linker’s internal tables overflowed. This usually means that the programs being linked have exceeded the linker’s
capacity for public symbols, external symbols, or for logical segment definitions. Each instance of a distinct segment
name in an object file counts as a logical segment; if two object files define this segment, then this results in two logical
segments.
Table limit exceeded–>try linking with extended dictionaries Linker error
This error occurs if you are linking many object modules, each with many segment definition records. Turning on
extended dictionaries will cause the linker to process fewer modules, eliminating unnecessary caching of these records.
Make sure that the libraries that are being linked ALL have extended dictionaries. If you are not sure, run TLIB/E on the
libraries, and extended dictionaries will be constructed.
Target index of FIXUP is 0 in module module Linker error
This is a translator error.
Template argument must be a constant expression Compiler error
A non-type actual template class argument must be a constant expression (of the appropriate type); this includes
constant integral expressions, and addresses of objects or functions with external linkage or members.
Template class nesting too deep: ‘class’ Compiler error
The compiler imposes a certain limit on the level of template class nesting; this limit is usually exceeded only through a
recursive template class dependency. When this nesting limit is exceeded, the compiler issues this error message for all
of the nested template classes, which usually makes it easy to spot the recursion. This is always followed by the fatal
error Out of memory.
For example, consider the following set of template classes:
template<class T> class A
{
friend class B<T*>;
};

template<class T> class B


{
friend class A<T>;
};

A<int> x;
This code will be flagged with the following errors:
Error: Template class nesting too deep: 'B<int * * * * *>'
Error: Template class nesting too deep: 'A<int * * * *>'
Error: Template class nesting too deep: 'B<int * * * *>'
Error: Template class nesting too deep: 'A<int * * *>'
Error: Template class nesting too deep: 'B<int * * *>'
Error: Template class nesting too deep: 'A<int * *>'

264 User’s Guide


Error: Template class nesting too deep: 'B<int * *>'
Error: Template class nesting too deep: 'A<int *>'
Error: Template class nesting too deep: 'B<int *>'
Error: Template class nesting too deep: 'A<int>'
Fatal: Out of memory
Template function argument argument not used in argument types Compiler error
The given argument was not used in the argument list of the function. The argument list of a template function must use
all of the template formal arguments; otherwise, there is no way to generate a template function instance based on actual
argument types.
Template functions may only have type-arguments Compiler error
A function template was declared with a non-type argument. This is not allowed with a template function because there
is no way to specify the value when calling it.
Templates can only be declared at file level Compiler error
Templates cannot be declared inside classes or functions; they are allowed only in the global scope (file level).
Templates must be classes or functions Compiler error
The declaration in a template declaration must specify either a class type or a function.
Temporary used to initialize identifier Compiler warning
Temporary used for parameter number in call to function Compiler warning
Temporary used for parameter number Compiler warning
Temporary used for parameter parameter Compiler warning
In C++, a variable or parameter of reference type must be assigned a reference to an object of the same type. If the types
do not match, the actual value is assigned to a temporary of the correct type, and the address of the temporary is
assigned to the reference variable or parameter. The warning means that the reference variable or parameter does not
refer to what you expect, but to a temporary variable, otherwise unused.
In the following example, function f requires a reference to an int, and c is a char:
f(int&);
char c;
f(c);
Instead of calling f with the address of c, the compiler generates code equivalent to the C++ source code:
int X = c, f(X);
Terminated by user Linker error
You canceled the link.
The ‘...’ handler must be last Compiler error
In a list of catch handlers, if the ‘...’ handler is present, it must be the last handler in the list (that is, it cannot be followed
by any more catch handlers).
The combinations ‘+*’ or ‘*+’ are not allowed Librarian error
It is not legal to add and extract an object module from a library in one action. The action probably desired is a ‘+–’.
The constructor constructor is not allowed Compiler error
Constructors of the form X::(X) are not allowed. The correct way to write a copy constructor is X::(const X&).
The value for identifier is not within the range of an int Compiler error
All enumerators must have values that can be represented as an integer. You attempted to assign a value that is out of
the range of an integer. In C++ if you need a constant of this value, use a const integer.
‘this’ can be used only within a member function Compiler error
In C++, this is a reserved word that can be used only within class member functions.
This initialization is only partly bracketed Compiler warning
When structures are initialized, braces can be used to mark the initialization of each member of the structure. If a
member itself is an array or structure, nested pairs of braces can be used. When some of the optional braces are omitted,
the compiler issues this warning.
Too few arguments in template class name template Compiler error
A template class name was missing actual values for some of its formal parameters.

Appendix C, Error messages 265


Too few parameters in call Compiler error
A call to a function with a prototype (via a function pointer) had too few arguments. Prototypes require that all
parameters be given.
Too few parameters in call to function Compiler error
A call to the named function (declared using a prototype) had too few arguments.
Too many commas on command-line Linker error
An invalid entry in the command-line was found.
Too many decimal points Compiler error
The compiler encountered a floating-point constant with more than one decimal point.
Too many default cases Compiler error
The compiler encountered more than one default statement in a single switch.
Too many default libraries Compiler error
The linker can handle a maximum of 128 default libraries.
Too many error or warning messages Compiler error
A maximum of 255 errors and warnings can be set before the compiler stops.
Too many error or warning messages Linker error
The number of messages reported by the compiler has exceeded its limit. This error indicates that TLINK reached its
limit.
Too many errors Linker error
The linker encountered more errors than the –E switch will permit.
Too many exponents Compiler error
The compiler encountered more than one exponent in a floating-point constant.
Too many initializers Compiler error
The compiler encountered more initializers than were allowed by the declaration being initialized.
Too many LNAMEs Linker error
TLINK has a limit of 256 LNAMES in a single .OBJ file.
Too many rules for target target MAKE error
MAKE can’t determine which rules to follow when building a target because you’ve created too many rules for the
target. For example, the following makefile generates this error message:
abc.exe : a.obj
bcc -c a.c

abc.exe : b.obj

abc.exe : c.obj
bcc -c b.c c.c
Too many storage classes in declaration Compiler error
A declaration can never have more than one storage class.
Too many suffixes in .SUFFIXES list MAKE error
The limit of 255 allowable suffixes in the suffixes list has been exceeded.
Too many types in declaration Compiler error
A declaration can never have more than one of the basic types: char, int, float, double, struct, union, enum, or typedef–
name.
Too much global data defined in file Compiler error
The sum of the global data declarations exceeds 64K bytes. Check the declarations for any array that might be too large.
Also consider reorganizing the program or using far variables if all the declarations are needed.
Trying to derive a far class from the huge base base Compiler error
If a class is declared (or defaults to) huge, all derived classes must also be huge.

266 User’s Guide


Trying to derive a far class from the near base base Compiler error
If a class is declared (or defaults to) near, all derived classes must also be near.
Trying to derive a huge class from the far base base Compiler error
If a class is declared (or defaults to) far, all derived classes must also be far.
Trying to derive a huge class from the near base base Compiler error
If a class is declared (or defaults to) near, all derived classes must also be near.
Trying to derive a near class from the far base base Compiler error
If a class is declared (or defaults to) far, all derived classes must also be far.
Trying to derive a near class from the huge base base Compiler error
If a class is declared (or defaults to) huge, all derived classes must also be huge.
Two consecutive dots Compiler error
Because an ellipsis contains three dots (...), and a decimal point or member selection operator uses one dot (.), two
consecutive dots cannot legally occur in a C program.
Two operands must evaluate to the same type Compiler error
The types of the expressions on both sides of the colon in the conditional expression operator (?:) must be the same,
except for the usual conversions like char to int, or float to double, or void* to a particular pointer. In this expression,
the two sides evaluate to different types that are not automatically converted. This might be an error or you might
merely need to cast one side to the type of the other.
Type type is not a defined class with virtual functions Compiler error
A dynamic_cast was used with a pointer to a class type that is either undefined or doesn’t have any virtual member
functions.
Note on type-mismatch errors: When compiling C++ programs, the following type-mismatch error messages are always
preceded by another message that explains the exact reason for the type mismatch; this is usually “Cannot converttype1
to type2” but the mismatch could also be due to many other reasons.
Type type may not be defined here Compiler error
Classes and enumerations may not be defined in certain places. For example, the return type specification of a function.
The class or enum definition must be moved into a separate type declaration.
Type mismatch in default argument value Compiler error
Type mismatch in default value for parameter parameter Compiler error
The default parameter value given could not be converted to the type of the parameter. The first message is used when
the parameter was not given a name. See the previous note on type-mismatch errors.
Type mismatch in parameter number Compiler error
The function called, via a function pointer, was declared with a prototype; the given parameter number (counting left to
right from 1) could not be converted to the declared parameter type. See the previous note on type-mismatch errors.
Type mismatch in parameter number in call to function Compiler error
Your source file declared the named function with a prototype, and the given parameter number (counting left to right
from 1) could not be converted to the declared parameter type. See the previous note on type-mismatch errors.
Type mismatch in parameter parameter Compiler error
Your source file declared the function called via a function pointer with a prototype, and the named parameter could not
be converted to the declared parameter type. See the previous note on type-mismatch errors.
Type mismatch in parameter parameter in call to function Compiler error
Your source file declared the named function with a prototype, and the named parameter could not be converted to the
declared parameter type. See entry for Type mismatch in parameter parameter and the previous note on type-
mismatch errors.
Type mismatch in parameter parameter in template class name template Compiler error
Type mismatch in parameter number in template class name template Compiler error
The actual template argument value supplied for the given parameter did not exactly match the formal template
parameter type. See the previous note on type-mismatch errors.
Type mismatch in redeclaration of identifier Compiler error
Your source file redeclared with a different type than was originally declared. This can occur if a function is called and
subsequently declared to return something other than an integer. If this has happened, you must declare the function
before the first call to it. See the previous note on type-mismatch errors.

Appendix C, Error messages 267


Type name expected Compiler error
One of these errors has occurred:
In declaring a file-level variable or a struct field, neither a type name nor a storage class was given.
In declaring a typedef, no type for the name was supplied.
In declaring a destructor for a C++ class, the destructor name was not a type name (it must be the same name as its
class).
In supplying a C++ base class name, the name was not the name of a class.
Type qualifier identifier must be a struct or class name Compiler error
The C++ qualifier in the construction qual::identifier is not the name of a struct or class.
Unable to create output file filename Compiler error
The work disk is full or write-protected or the output directory does not exist. If the disk is full, try deleting unneeded
files and restarting the compilation. If the disk is write-protected, move the source files to a writable disk and restart the
compilation.
Unable to create turboc.$ln Compiler error
The compiler cannot create the temporary file TURBOC.$LN because it cannot access the disk or the disk is full.
Unable to execute command: command MAKE error
A command failed to execute; this might be because the command file could not be found or was misspelled, because
there was no disk space left in the specified swap directory, because the swap directory does not exist, or (less likely)
because the command itself exists but has been corrupted.
Unable to execute command command Compiler error
TLINK or TASM cannot be found, or possibly the disk is bad.
Unable to open file filename MAKE error
Unable to open filename Linker error
This occurs if the named file does not exist or is misspelled.
Unable to open filename for output Librarian error
The librarian cannot open the specified file for output. This is usually due to lack of disk space for the target library, or a
listing file.
Unable to open include file filename Compiler error
The compiler could not find the named file. This error can also be caused if an #include file included itself, or if you do
not have FILES set in CONFIG.SYS on your root directory (try FILES=20). Check whether the named file exists.
Unable to open include file filename MAKE error
The compiler could not find the named file. This error can also be caused if an !include file included itself, or if you do
not have FILES set in CONFIG.SYS on your root directory (try FILES=20). Check whether the named file exists.
Unable to open input file filename Compiler error
This error occurs if the source file cannot be found. Check the spelling of the name and whether the file is on the proper
disk or directory.
Unable to open makefile MAKE error
The current directory does not contain a file named MAKEFILE or MAKEFILE.MAK, or it does not contain the file you
specified with –f.
Unable to process debug information, disable tasm /zi option Linker error
This happens when you compile .C or .CPP code with debug information, generating assembler output, and then run
TASM on the result with the /zi option. Do not use the /zi option. The compiler already generated the appropriate debug
information.
Unable to redirect input or output MAKE error
MAKE was unable to open the temporary files necessary to redirect input or output. If you are on a network, make sure
you have rights to the current directory.
Unable to rename filename to filename Librarian error
The librarian builds a library into a temporary file and then renames the temporary file to the target library file name. If
there is an error, usually due to lack of disk space, this message is posted.
Undefined alias symbol symbol Linker error
An ALIAS definition record was encountered which specified a substitute public symbol for an external reference. The
public symbol was never found. ALIAS records are generated by the assembler when the ALIAS directive is used.

268 User’s Guide


Undefined label identifier Compiler error
The named label has a goto in the function, but no label definition.
Undefined structure identifier Compiler warning
The named structure was used in the source file, probably on a pointer to a structure, but had no definition in the source
file. This is probably caused by a misspelled structure name or a missing declaration.
Undefined structure structure Compiler error
Your source file used the named structure on some line before where the error is indicated (probably on a pointer to a
structure) but had no definition for the structure. This is probably caused by a misspelled structure name or a missing
declaration.
Undefined symbol identifier Compiler error
The named identifier has no declaration. This could be caused by a misspelling either at this point or at the declaration.
This could also be caused if there was an error in the declaration of the identifier.
Undefined symbol symbol Linker error
The named symbol is referenced in the given module but is not defined anywhere in the set of object files and libraries
included in the link. Check to make sure the symbol is spelled correctly.
You will usually see this error from TLINK for Turbo C++ symbols if you did not properly match a symbol’s
declarations of pascal and cdecl type in different source files, or if you have omitted the name of an .OBJ file your
program needs. If you are linking C++ code with C modules, you might have forgotten to wrap C external declarations
in extern "C" {...}. You might have a case mismatch between two symbols. See the /C and /c switches.
Unexpected } Compiler error
An extra right brace was encountered where none was expected. Check for a missing {.
Unexpected char X in command line Librarian error
The librarian encountered a syntactical error while parsing the command line.
Unexpected end of file MAKE error
The end of the makefile was reached without a temporary inline file having been closed.
Unexpected end of file in comment started on line number MAKE error
The source file ended in the middle of a comment. This is normally caused by a missing close of comment (*/).
Unexpected end of file in conditional started on line line number Compiler error
The source file ended before the compiler (or MAKE) encountered an !endif. The !endif was either missing or
misspelled.
Union cannot be a base type Compiler error
A union cannot be used as a base type for another class type.
Union cannot have a base type Compiler error
A union cannot be derived from any other class.
Union member member is of type class with constructor Compiler error
Union member member is of type class with destructor Compiler error
Union member member is of type class with operator= Compiler error
A union cannot contain members that are of type class with user-defined constructors, destructors, or operator=.
Unions cannot have virtual member functions Compiler error
A union cannot have virtual functions as its members.
Unknown assembler instruction Compiler warning
The compiler encountered an inline assembly statement.
Unknown command line switch X ignored Librarian warning
A forward slash character (/) was encountered on the command line or in a response file without being followed by one
of the allowed options.
Unknown Goodie Linker error
An unsupported option was supplied to the command-line linker. See the documentation for currently supported
Goodies (options).
Unknown language, must be C or C++ Compiler error
In the C++ construction

Appendix C, Error messages 269


extern "name" type func( /*...*/ );
the name given in quotes must be “C” or “C++”; other language names are not recognized. For example, you can
declare an external Pascal function without having the compiler rename it like this:
extern "C" int pascal func( /*...*/ );
A C++ (possibly overloaded) function can be declared Pascal and allow the usual compiler renaming (to allow
overloading) like this:
extern int pascal func( /*...*/ );
Unknown option –> option Linker error
A forward slash character (/), hyphen (), or DOS switch character was encountered on the command line or in a
response file without being followed by one of the allowed options. You might have used the wrong case to specify an
option.
Unknown preprocessor directive: identifier Compiler error
The compiler encountered a # character at the beginning of a line, and the name following was not a legal directive name
or the rest of the directive was not well formed.
Unknown preprocessor statement MAKE error
A ! character was encountered at the beginning of a line, and the statement name following was noterror, undef, if, elif,
include, else, or endif.
Unreachable code Compiler warning
A break, continue, goto or return statement was not followed by a label or the end of a loop or function. The compiler
checks while, do and for loops with a constant test condition, and attempts to recognize loops that cannot fall through.
Unsupported option string Linker error
You have specified an invalid option to the linker.
Unterminated string or character constant Compiler error
The compiler found no terminating quote after the beginning of a string or character constant.
Use ‘> >’ for nested templates instead of ‘>>’ Compiler warning
Whitespace is required to separate the closing “>” in a nested template name, but since it is a common mistake to leave
out the space, the compiler accepts a “>>” with this warning.
Use . or –> to call function Compiler error
You tried to call a member function without giving an object.
Use . or –> to call member, or & to take its address Compiler error
A reference to a nonstatic class member without an object was encountered. Such a member must be used with an
object, or its address must be taken with the & operator.
Use :: to take the address of a member function Compiler error
If f is a member function of class c, you take its address with the syntax &c::f. Note the use of the class type name, rather
than the name of an object, and the :: separating the class name from the function name. (Member function pointers are
not true pointer types, and do not refer to any particular instance of a class.)
Use /e with TLINK to obtain debug information from library Librarian warning
The library was built with an extended dictionary and also includes debugging information. TLINK will not extract
debugging information if it links using an extended dictionary, so to obtain debugging information in an executable
from this library, the linker must be told to ignore the extended dictionary using the /e switch. Note: The IDE linker does
not support extended dictionaries; therefore no settings need to be altered in the IDE.
Use of : and :: dependents for target target MAKE error
You have tried to use the target in both single and multiple description blocks (using both the : and :: operators).
Examples:
filea: fileb
filea:: filec
Use qualified name to access nested type type Compiler warning
In older versions of the C++ specification, typedef and tag names declared inside classes were directly visible in the
global scope. With the latest specification of C++, these names must be prefixed with a class:: qualifier if they are to be
used outside their class’ scope. To allow older code to compile, whenever such a name is uniquely defined in one single
class, Turbo C++ allows its usage without class:: and issues this warning.

270 User’s Guide


User break Compiler error
You pressed Ctrl+Break while compiling or linking in the IDE, thus aborting the process. (This is not an error, just a
confirmation.)
User break, library aborted Librarian error
You pressed Ctrl+Break to abort the build of the library.
Value of type void is not allowed Compiler error
A value of type void is really not a value at all, and thus cannot appear in any context where an actual value is required.
Such contexts include the right side of an assignment, an argument of a function, and the controlling expression of anif,
for, or while statement.
VIRDEF Name Conflict for function Compiler error
The compiler must truncate mangled names to a certain length because of a name length limit that is imposed by the
linker. This truncation might (in rare cases) cause two names to mangle to the same linker name. If these names happen
to both be VIRDEF names, the compiler issues this error message. The simplest workaround for this problem is to
change the name of function so that the conflict is avoided.
Variable variable has been optimized and is not available IDE debugger error
You have tried to inspect, watch, or otherwise access a variable which the optimizer removed. This variable is never
assigned a value and has no stack location. Recompile your program without optimizations if you need to inspect this
variable.
Variable identifier is initialized more than once Compiler error
This variable has more than one initialization. It is legal to declare a file level variable more than once, but it can have
only one initialization (even if two are the same).
‘virtual’ can only be used with member functions Compiler error
A data member has been declared with the virtual specifier; only member functions can be declared virtual.
Virtual function function1 conflicts with base class base Compiler error
The compiler encountered a virtual function that has the same argument types as a function in its base class, but the two
functions have different return types. This is illegal.
Virtual specified more than once Compiler error
The C++ reserved word virtual can appear only once in a member function declaration.
void & is not a valid type Compiler error
A reference always refers to an object, but an object cannot have the type void. Thus the type void is not allowed.
Void functions may not return a value Compiler warning
Your source file declared the current function as returning void, but the compiler encountered a return statement with a
value. The value of the return statement will be ignored.
function was previously declared with the languagelanguage Compiler error
Only one language can be used with extern for a given function. This function has been declared with different
languages in different locations in the same module.
While statement missing ( Compiler error
In a while statement, the compiler found no left parenthesis after the while keyword.
While statement missing ) Compiler error
In a while statement, the compiler found no right parenthesis after the test expression.
This occurs if TLINK could not write all of the data it attempted to write. This is almost certainly caused by the disk
being full.
Write error on file filename MAKE error
MAKE couldn’t open or write to the file specified in the makefile. Check to ensure that there’s enough space left on your
disk, and that you have write access to the disk.
Write failed, disk full? Linker error
This occurs if the linker could not write all of the data it attempted to write. This is almost certainly caused by the disk
being full.
Wrong number of arguments in call of macro mac Compiler error
Your source file called the named macro with an incorrect number of arguments.

Appendix C, Error messages 271


272 User’s Guide
Index
Symbols accessing IDE SpeedMenus 9 creating applications 62–67
accessing source files 21 default files 62
& (ampersand) Actual Size command modifying code 65, 66
adding to menus 173, 174 (resources) 195 options 68–74
+ (plus sign) Add Breakpoint command 96 specifying 64
AppExpert hierarchies 62 Add Comment command 108 organizing project files 62
Environment Options dialog Add Handler command overview 62
box 14 (ClassExpert) 79 rebuilding projects 82
Project Manager 20 Add New Class dialog box 77 SpeedMenu 62
– (hyphen) Add Node option 24 starting 62
AppExpert hierarchies 62 targets, default viewer 75
Add Watch command 101
Environment Options dialog AppExpert Application
adding watches 101
box 14 Generation Options dialog
addresses
Project Manager 20 exceptions 123 box 62, 63, 68
symbolic 56 applications 19
Numerics Advanced Options dialog box 32-bit See DOS; Windows
applications
16-bit Compiler option (Project adding tools 32
specifying source nodes 23 compiling See compilation
Options) 48–52 console
-AK compiler option 47
-3 compiler option 48 converting to
Align Center command Windows 215
/3 linker option 57
(resources) 192 creating 30, 61
32-bit applications See DOS;
Align command (resources) 158 entry/exit code options 51
Windows applications
Align Controls dialog box 158 linking See linkage
386 enhanced mode 55
Align Left command main windows
3-D controls 153, 169
(resources) 192 dialog boxes as 61, 149
-4 compiler option 48
Align Right command testing 30, 91
80x86 processors
compiler options 50 (resources) 192 Windows See Windows
segmentation 50 alignment applications
attribute (Intel) 56 .APX files 82
code pages 57 rebuilding 83
A compiler options 48 arguments 107
-A compiler option 46, 47 graphics 192, 193 See also parameters
-a compiler option 48 text 192 Array command (resources) 159
Absolute Align property 150 in controls 161, 163 arrays
ACBP fields (Intel) 56 Alignment palette debugging 102, 105
Accelerator editor Dialog editor 148, 158 huge 50
(resources) 178 Alignment property 161 inspecting 105
customizing 181 scroll bars 164 viewing 106
Accelerator Key Value command All Windows command ASCII codes
(resources) 175 (Messages) 115 watches and 104
accelerator tables 171, 176 allocation ASCII files See text files
adding accelerators 179 compiler options 45 ASCII keys 175, 176
editing scripts 178–179 memory See memory assembly language
accelerators 178–181 alternative translators 31 command-line options 53
changing keys 180 Alt-key shortcuts 176 integrated debugger and 95
checking for duplicate ampersand (&) -AT compiler option 46
keys 181 adding to menus 173, 174 attributes
manipulating 180 ancestor-descendant bit fields 56
menus 175–176 relationships 86 project nodes 24, 26, 30
naming 179 ANSI codes syntax highlighting 15
source code 181–182 bitmapped fonts and 198–199 -AU compiler option 47
viewing 178 AppExpert 61 Auto Horizontal property 166

Index 273
autodependency information metafiles vs. 205 Build All command (Project) 41,
MAKE 46 properties, setting 196 64
Project Manager 20 resizing 196 Build Node option 42
autodependency nodes 20, 40 resource scripts and 138 building projects 35
automatic error tracking 43 blank lines in code canceling builds 41
automatic file linkage 20 breakpoints and 97 MAKE vs. 41
Automatic Horizontal Scroll .BMP files 143 specific parts 42
property 165 Boolean expressions BUILDSYM.EXE 129
Automatic Vertical Scroll breakpoints and 99 buttons
property 165 Border property 161 See also specific types
automatically generating borders 189 Alignment palette
underscores 46 dialog boxes 150, 152, 161 (resources) 148
automatically saving IDE main windows 71 dialog boxes 152
settings 17 pop-up windows 167 IDE SpeedBars 9
automation servers See servers Borland Assist program 4 adding/deleting 16
(automation) Borland C++ compiling options 41
starting IDE 7 customizing 16
Borland resource compilers See Tools palette (resources) 148,
B BRCC.EXE; BRCC32.EXE 188
-b compiler option 45 Borland resource linkers See byte-wise alignment 48
background colors RLINK.EXE; RLINK32.DLL
dialog boxes 149 Borland Visual Solutions C
graphics resources 189 Pack 153
main windows 71 /C linker option 55
break character (fonts) 199
syntax highlighting 15 /c linker option 55
Breakpoint command 97
backward compatibility C calling convention 48
Breakpoint Properties dialog
loading project files 27 C language See ANSI C; Borland
box 98, 99
base classes C++
breakpoints 96–100
compiler options 52 See also debugging C++ Options option (Project
BBN_GOTABTAB message 153 conditional 99 Options) 52–54
BBN_GOTATAB message 153 customizing colors 100 Call Stack command 107
BBN_SETFOCUS message 153 deleting 98 Call Stack window 107–108
BBN_SETFOCUSMOUSE disabling 97 opening 107
message 153 invalid 97, 100 Calling Convention option
BCC.EXE properties 98–100 (Project Options) 48
See also command-line setting 95, 96–97 calling conventions
compilers after program start 96 fastthis 45
BCC32.EXE pass counts and 99 Pascal See Pascal
See also command-line skipping over 99 calls
compilers viewing 97, 100 far 57
BCCONFIG.BCW 17 Breakpoints window 97 function See function calls
BCDEF.CSM 217, 218 opening 97 optimizing 57
reducing size 219 Brief editor, emulating 15 Windows programs See
BCWDEF.DSW 17 Browse Symbol command Windows API calls
big attribute 56 (Search) 86 canceling builds 41
binary data 134 browser (IDE) 85–88 Caption property 160
WinSpector reports, configuring 87 Caption Type property 161
processing 126 customizing 88 captions
binary files error messages 86 controls 160, 161
resources 142–143 filters, setting 87 main windows 71
bit fields overview 86–87 cascading menus 173, 178
ACBP (Intel) 56 searching for symbols 88 case
bitmap buttons 162 starting 85, 86 controls, setting 164
bitmapped fonts 198–199 brushes (resources) 190 Case property 164
bitmaps 187, 201, 202 buffers case sensitivity
See also graphics transfer 80 external symbols 55
public symbols 55

274 User’s Guide


.CBK files 15 creating document types 78– colors
central processing unit See CPU 79 breakpoints, customizing 100
.CFG files See configuration files default files 78 graphics resources 189, 195,
CGA Resolution command deleting classes 82 197, 200
(resources) 195 editor 76 syntax highlighting and 15
Change Identifier Prefix event handlers 76, 79, 83 text 192
command (resources) 178, 181 importing classes 83 Colors palette
changes, source code, options 76 Graphic editor 188, 189
undoing 10 new classes 77 customizing 200–201
character sets 198 overview 76 hiding 200
OEM 165, 166 renaming classes 83 combining attribute 56
resources and 81 combo boxes 152
characters
associating with properties, setting 166
newline classes 75, 80
static controls 163 COMDEFs (communal
handling controls 80 variables) 46, 50
null retrieving information
resource scripts 212 command-line compilers
on 82 resources See resource
right-align 173, 174 SpeedMenus 76
tab compilers
starting 75 command-line options
menus 173, 174 viewing source code 76, 81
static controls 163 debugging 47
underlining ClassExpert command integrated debugger and 92
static text controls 161 (View) 75 messages 54
check boxes 152 ClassExpert window 76 precompiled headers 218, 219
properties, setting 163 editing code 76 setting from IDE 35–40
Check Dup Keys command Clear Events command 108 commands
(resources) 181 clearing IDE error messages 43 menu See menu commands
Check Duplicates command client windows comments
(resources) 177 AppExpert options 72 AppExpert and 66
child nodes 38, 41 Clip Children property 150 breakpoints and 97
child windows Clip Siblings property 150 logging 108, 122
AppExpert options 71, 73 code 9 communal variables 46, 50
viewing 114 See also source code compatibility See backward
circles, drawing 191 blank lines, breakpoints compatibility
and 97 compilation 19, 41–42
.CKB files 15
compiler options, setting 44 compiler errors and 222
Class property 149 defining color and font
classes 75 debugger and 91, 92
attributes 15 DOS applications
adding 76–78 editing 9, 43
compiler options 52 as Windows 215
AppExpert 65, 66 fatal errors and 221
defining 218 Breakpoints window 97
deleting from ClassExpert generating browser
Call Stack window 107 information 85
projects 82 ClassExpert window 76
importing 83 large modules 217
headers and 218 large programs 217
moving 82, 83 IDE options 22
non-GUI 77 nodes in Source Pools 29
line numbers 57 resources 142, 212
renaming 83 undoing changes 10
resources and 75, 80 specific project parts 42
code segments 55 stopping 55
viewing 75, 76 compiler options 51
window 67 syntax errors 42–43
detailed maps 56 warnings and 222
currently registered 113 packing 55
retrieving information Compile command (Project) 13,
renaming 51 41
on 111 Code-Generation option (Project
Classes command (View) 86 Compiler option (Project
Options) 45 Options) 45–50
ClassExpert 75 collapsing lists
adding classes 76–78 compiler options 43–58
AppExpert hierarchies 62 See also command-line options
AppExpert and 62, 65 dialog boxes 14
comment records 65 language extensions 46
Project Manager 20 messages 54

Index 275
shortcuts 41 .CPP files 10 renaming 50
Compiler Output option (Project CPU uninitialized 50
Options) 46 flags 106 data types
compilers 217 registers, checking 106 char
See also command-line Create option (Style Sheets) 37 treating as unsigned 45
compilers creating compiler options 45, 53
error messages 222 new program files 10 resources, customizing 205,
Help systems 22, 222 DOS platforms 11 206, 211–212, 213
warnings, ignoring 13 Windows platforms 12 databases 153
compiling errors new projects 21–23, 36, 58 -dc compiler option 49
viewing 43 resources See Resource Debug command (IDE) 8
Compose option (Style Workshop Debug menu 89
Sheets) 37 Source Pools 29 debugger 89
compressed formats .CSM files 218 accessing 89
bitmaps 196 reducing size 219 compiler options and 92
fonts 198 CTL3D2V.DLL 169 controlling program
conditional breakpoints 99 Ctrl-key shortcuts 176 execution 92–96
disabling 97 .CUR files 143 deleting breakpoints 98
pass counts and 100 cursors disabling breakpoints 97
conditions position, Edit window 9 evaluating expressions 100,
breakpoints (defined) 99 cursors (graphics 101, 103–105
conforming extensions 46 resources) 187, 202, 203 changing values and 105
console applications creating 195–196 restrictions 103
converting to Windows 215 defining hot spots 196 examining register values 106
constants inverted areas 189 execution point 93, 100, 107
resources properties, setting 196 flickering screens,
versions 208–211 removing images 195 eliminating 91
Control ID property 162 testing 195 inspecting data elements 105
control-menu box transparent areas 189 invalid breakpoints 97, 100
adding to main window 71 viewing 194 loading symbol tables 109
controls 69, 80 Custom Control tool logging messages 108
See also resources (resources) 154 moving through code 93–95
aligning 148, 157–160 customer assistance 4 single stepping 93
text 161, 163 customizing Resource multiple statements and 92
arranging 159 multitasking and 109
Workshop 144–145
captions 160, 161 restarting programs 95
customizing the IDE 14–17
custom 153–154 running programs 91–92
CWH.HLP 22 to breakpoints 95
dialog boxes See dialog boxes
setting breakpoints 95, 96–97
focus, setting 153
grouping/ungrouping 157
D after program start 96
conditional 99
installing 153 -d compiler option 45 pass counts and 99
invisible 161 data starting 90
moving 155, 156 alignment stepping over code 94
naming 161 compiler options 48 stopping programs 95, 99,
painting 149 binary 134 108
resizing 155–156 WinSpector reports, symbolic debug
selecting 154, 161 processing 126 information 91, 93
tab order 157 far 50 DLLs and 109
three-dimensional 153, 169 IDE options 22 tracing into code 93–94, 107
conversions inspecting 105 DLLs and 109
DOS applications to resources and 135 viewing breakpoints 97, 100
Windows 215–216 values, changing 104, 105 watching expressions 101–
Convert OEM property 165 data objects 90 103
Copy option (Style Sheets) 38 data segments deleting watches 103
copying project nodes 26–27 compiler options 49, 50 disabling watches 102
copyright information 70 detailed maps 56 formatting watches 102,
resources 211 removing virtual tables 49 104

276 User’s Guide


debugging 56 classes 82 Style window 161–168
See also debugger event handlers 79 Test tool 168
arrays 102, 105 instance variables 80 Tools palette 148, 152
assembly code 95 project nodes 24, 25 adding custom
bugs, types 89–90 resources 176, 195 controls 154
compiler options 47 from script files 140, 141 undoing current actions 160
DLLs 109 Style Sheets 38 dimming menu commands 174
expressions 100–106 watches 103 directories
external programs 95 derived classes file-search algorithms 44
functions 93, 94, 107–108 compiler options 52 hierarchy trees See Project
locating specific 108 descendant relationships, Tree
member functions 95 viewing 86 Directories option (Project
modes 109 desktop, viewing existing Options) 43
sessions, beginning 91 windows 114–115 directory paths 69
statements 92, 93 destructors 54 Disable All Breakpoints
in loops 100 DFA utility 126–128 command 98
strategy 90–92 DFA.EXE 126 Disable Breakpoint command 98
structures 104 diacritical marks 198 Disable Watch command 103
subroutines 47 dialog boxes 147 disabling
variables 99, 103 adding menus 149 autogenerating
Windows applications 109, backgrounds 149 underscores 46
111, 128 collapsing lists 14 breakpoints 97
Debugging option (Project controls 152 invalid 97
Options) 47 adding 151–153 drawing tools 200
debugging tools 111, 120 aligning 148, 157–160 menu commands 174
decimal values custom 153–154 message tracing 112
resources and 212 grouping 157 palettes 200
watches and 102, 104 messages 153, 161 syntax highlighting 16
declarations moving 155, 156 watches 102
breakpoints and 97 painting 149 dispatched messages 115
.DEF files See module-definition resizing 155–156 displaying
files selecting 154, 161 project nodes 20
default file names 10, 21 tabbing through 157 warnings 55
default keymapping 15 three-dimensional 153, DLLs
default libraries 169 browsing through 85
overriding 55 creating See Dialog editor debugging 109
default settings editing scripts 147–149 packing code segments 55
IDE SpeedBars 17 expanding lists 14
Document/View models 61, 68,
new projects 21, 58 frames 150, 152, 161
73
default translators 31 modal 170
document types 78–79
properties, setting 149–151,
default viewers 31 documentation, printing
160–168
AppExpert targets 75 conventions 3
resizing, automatically 151
resources 81 Don’t Redraw property 165
source code for 170
Defines option (Project styles 150 DOS applications
Options) 45 extended 151 32-bit executables
defining macros 45 testing 168 compiler options 51
definitions Dialog Client models 61, 68, 73 linking 57
public 53 Dialog editor (resources) 147– compiling
template instances 53 as Windows 215
149
virtual tables 53 converting to Windows
Alignment palette 148, 158
Delete All Breakpoints applications 215–216
customizing 169
command 98 creating 11
Duplicate tool 159
Delete Breakpoint command 98 IDE options 22
Properties window 160
Delete Node option 24, 25 Selector tool 154 DOS_TEST.CPP 11
Delete option (Style Sheets) 38 Set Groups tool 157 drag-and-drop actions 68
deleting Set Order tool 157 DRAW.IDE 64
breakpoints 98 starting 147 setting up 62

Index 277
DRAWAPP.CPP 65–67 resources 135, 138, 141, 206 Evaluate/Modify command 103
drawapp.h 65 dialog boxes 147–149 event handlers 76, 79
drawing 190–192, 200 graphics 187–188 deleting 79
brush shapes 190 in binary files 142 renaming 83
paint patterns 190 in graphics files 144 Event Log command 108
pen styles 189 in script files 136 Event Log window 100, 108
pop-up windows 149 menus 171–172 opening 108
drawing routines 149 string tables 183 events 75
drawing tools (resources) 148, Style Sheets 38, 41 exceptions 122
188, 200 editors 10 addresses 123
drive specifier 43 ClassExpert 76 compiler options 54
reconfiguring IDE 15 logging 122–126
drivers
resource scripts 135–136, 206 run-time identification 54
resources and 209
EGA/VGA Resolution .EXE files See executable files
drop-down lists See combo boxes
command (resources) 194, 195 executable files 129
.DSW files 17
ellipses, drawing 191 including debug
duplicate strings, merging 45
Enable Breakpoint command 98 information 91
Duplicate tool (resources) 159
Enable Watch command 103 reducing size 91
dynamic link libraries See DLLs
enabling menu commands 174 viewing 85
dynamic objects 54
enabling run-time type EXEMAP.EXE 128
information 54 exit code 51
E enhanced mode Exit command (Spy) 112
EasyWin 215–216 packing code segments 55 expanding lists
edit boxes 152 Entry/Exit Code option (Project AppExpert hierarchies 62
new lines 164 Options) 51 dialog boxes 14
properties, setting 164 enumerations Project Manager 20
Edit Breakpoint command 97, 98 treating as integers 45 export functions
Edit command (IDE) 8 environment compiler options 51–52
Edit Local Options command saving IDE settings 17 prologs and epilogs 51, 52
(IDE) 39 Environment command Expression Evaluator dialog
Edit menu (Options) 14 box 103–104
adding to menu bars 173 Environment Options dialog expressions
edit modes (IDE) 9 box 14 Boolean
Edit Node Attributes option 24, changing debugging breakpoints and 99
31 modes 110 changing 103
Edit option (Style Sheets) 38 expanding/contracting current value, viewing 101
Edit Source command 97, 107 lists 14 debugging 100–106
Edit window (IDE) 43 Project View options 28 evaluating 100, 101, 103–105
customizing 15 Epsilon editor, emulating 15 restrictions 103
debugging programs 92, 93, Eraser tool (resources) 192 inspecting 105
94, 96 error messages 221–271 logging 100, 108
deleting breakpoints 98 browser 86 Extend Select property 166
examining code 97, 107 compiler 54, 222 Extended Style property 151
inspecting data Help compiler 222 extensions
elements 105 IDE 42, 43 See also file-name extensions
setting watches 101 resources 183, 213 language, conforming 46
loading source files 21, 43 errors 43, 222 external modules 55
opening 10 automatically tracking 43 external programs,
overview 9 fatal 221, 222 debugging 95
SpeedMenu, activating 9 logic 90 external symbols 55
editing makefiles 222
code 43 run-time 89–90, 222 F
AppExpert 65, 66 syntax 42–43
Breakpoints window 97 TLINK 222 -f compiler option 46
Call Stack window 107 unrecoverable /f linker option 57
ClassExpert window 76 application 120, 127 far calls 57
node attributes 24, 26 viewing 43 far data 50

278 User’s Guide


far pointers Floating Point option (Project inspecting 105
compiler options 49, 50 Options) 46 Windows See Windows
_ _fastthis calling convention 45 floating-point libraries functions
fatal errors 221 compiler options 46 WinSpector and 124
Help compiler 222 floating-point operations with no parameters 47
-Fc compiler option 46 calculations, turning off 46
-Ff compiler option 50 optimizing 46 G
-ff compiler option 46 floating-point values
File command (IDE) 8 watches and 102, 104 -g compiler option 55
file filters flood-filling algorithm 191 General Protection Exception
AppExpert 74 .FNT files 143 dialog box 108
ClassExpert 78 focus See controls general protection faults 108, 120
File Manager (Windows) Font Character Width command generated files 62
adding source nodes 24 (resources) 198 generating symbolic debug
File menu Font command (resources) 192 information 91
adding to menu bars 173 Font Name property 150 generating underscores 46
file names 10, 21 Font Size command geometric shapes, drawing 191
AppExpert 62 (resources) 198, 199 global symbols
ClassExpert 78 Font Size property 150 searching for 88
files fonts 187, 198 viewing 86–87
See also specific program files break character, global variables
adding to projects 24 specifying 199 compiler options 50
binary See binary files changing 192 global virtual tables 53
compiler options, setting 44 specific characters 199 /Gm linker option 57
generated 62 character mapping 198–199 /Gn linker option 57
keyboard mapping 15 dialog boxes 150 GPFs 108, 120
log 108, 122, 122–126 properties, setting 197–199 /Gr linker option 57
map See map files syntax highlighting and 15 Graphic editor (resources) 187–
opening version information 209 188
backward compatible 27 foreground colors Airbrush tool 190
redistributable ii graphics resources 189 Colors palette 188, 189
symbol tables and 91 syntax highlighting 15 customizing 200–201
temporary 44 format specifiers hiding 200
text See text files watches 104 copying and moving
viewing in IDE 20 syntax 102 areas 193
file-search algorithms 44 formats customizing 199–201
fill patterns 190 compressed Eraser tool 192
filters 31 bitmaps 196 Hand tool 194
AppExpert 74 fonts 198 Line tool 191
browser 87 rich-text 222 manipulating areas 193
ClassExpert 78 files, generating 69 Paint Can tool 191
Filters matrix (IDE) 87 formatting watches 102, 104 Paint Pattern tool 190
Find Execution Point Frame Style property 150 Paintbrush tool 190
command 93 frame windows Pen Style tool 189
Find Window command properties, setting 77 Pick Rectangle tool 192
(Spy) 114 frames 167 Scissors tool 193
First Graphic command dialog boxes 150, 152, 161 selecting areas 192–193
(resources) 178 free-hand drawing 190 starting 187
fixed-width fonts 198 -Fs compiler option 49 Text tool 192
fixing errors 43 function calls Tools palette 188
viewing 107 hiding 200
flags
functions 47 window, splitting 200
checking 99
debugging 93, 94, 107–108 Zoom tool 194
status 106
locating specific 108 graphics 187, 205
flickering screens, eliminating 91
exporting See exporting adding text 192
floating menus 177 aligning 192, 193
functions
inline See inline functions

Index 279
brush shapes and warnings 218 inverted areas 189
patterns 190 heap, tracing into 126 properties, setting 197
colors 189, 195, 197 Height property 160 removing images 195
changing 200 Help command (IDE) 8 testing 195
creating See Graphic editor See also online help transparent areas 189
drawing and painting 189– Help compiler 22 viewing 194
192, 200 messages 222 ID source/Control ID
editing scripts 187–188 Help files, searching through property 161
enabling grids 201 multiple 4 ID Value property 161
erasing 192 Help menu 3 IDABORT constant 162
flood-filling algorithm 191 adding to menu bars 173 IDCANCEL constant 162
large 194 Help systems 61, 69, 222 .IDE files 21, 82
moving 194 About dialog box 70 See also project files
pen styles 189 Hex Values (WinSight IDE 7–18, 218
resource scripts and 138 option) 116 adding tools 31–33
RLE compression hexadecimal numbers browsing classes and
algorithm 196 resources and 212 objects 85–88
screen resolution, setting 194 customizing 14–17
hexadecimal values
source code for 201–203 keyboard shortcuts 15
watches and 102, 104
testing 195 Tool menu 18
viewing 194 Hide Palette command
(resources) 200 defining macros 45
multiple images 199 disabling invalid
zooming 194, 201 Hide Toolbox command
(resources) 200 breakpoints 97
graphics files displaying errors 42, 43
resources 143–144 hiding IDE SpeedBars 16
Edit window See Edit window
Grid command (resources) 159 hierarchies (classes) 86
generating resources 142
grids hierarchy trees See Project Tree integrated debugger,
aligning controls 159 history, recording 108 starting 90
enabling 201 See also log files menu 8
group boxes 152 Horizontal Scroll Bar predefined Style Sheets 36
properties, setting 164 property 161 preferences 17
Group property 157 horizontal scroll bars 164 Project Manager See Project
dialog boxes 152, 161 Manager
H main windows 71 Resource Workshop, starting
Horizontal Scroll property 150 from 135
-H compiler option 48 hot spots (cursors) 196 restoring defaults 17
-h compiler option 50 -Hu compiler option 48 running programs 18, 91–92
Hand tool (resources) 194 huge pointers saving settings 17
handlers compiler options 50 setting command-line options
See also event handlers debugging 47
hardware 2 I messages 54
Has Strings property 166 SpeedBars 9, 16
hdrfile pragma directive 218 -i compiler option 46 hiding 16
hdrstop pragma directive 219 /i linker option 57 SpeedMenus 9
Header command I/O starting 7
(resources) 197 See also input; output viewing program status 9
header files .ICO files 143 windows 16
compiler options 48 icons See also specific window
parsing 217 Alignment palette 148 identical SpeedBars 17
referencing 29 program 7 identifiers
resources 141, 142 Tools palette 148, 188 See also names
headers used in documentation 3 conflicts 46
containing code 218 icons (graphics resources) 138, generating underscores
precompiled 217–220 187, 202, 203 automatically 46
compiler options 218, 219 as controls 152, 167 resources 136, 140–142, 184
optimizing 219–220 colors, setting 197 accelerators 179
storing 217, 218 creating 195–196 changing 178, 181, 184
checking for duplicate 177

280 User’s Guide


controls 161 Integral Height property 165, dynamic link See DLLs
renaming 83 166 file-search algorithms 44
significant length 46 integrated debugger See floating-point 46
truncated 46 debugger ignoring default 55
virtual keys 176 integrated development import See import libraries
Identifiers command environment See IDE run-time See run-time
(resources) 140 Intel libraries
Identifiers dialog box 140 ACBP fields 56 specifying 22
IDIGNORE constant 163 interfaces See user interfaces line controls 167
idle symbols 56 international line numbers
IDNO constant 163 versions, resources 139–140, including in .OBJ files 47
IDOK constant 162 209–210 map files 57
IDRETRY constant 163 Interpret Values option returning in Edit window 9
IDYES constant 163 (WinSight) 116 Line property 165
ignoring warnings 13 invalid breakpoints 97, 100 Line tool (resources) 191
images (defined) 195 Invalid Breakpoints dialog lines, drawing 189, 191
import librarian See IMPLIB box 97 linkage 41
importing classes 83 invisible controls 161 32-bit applications 57
importing project files 27 automatic 20
external modules 55
#include directive 44
include files
J floating-point libraries 46
file-search algorithms 44 -j compiler option 55 generating browser
include paths See directory paths -Jg compiler option 53 information 85
inheritance 76 -Jgd compiler option 54 resources 142
multiple 52 -Jgx compiler option 54 Windows applications 23
project options 36, 38 linker errors 222
Linker option (Project
_InitEasyWin function 215–216 K Options) 55
initialization
variables 46 -K compiler option 45 linkers See RLINK; TLINK
inline expansion 47 -k compiler option 47 linking and embedding servers
inline functions -K2 compiler option 53 See servers (linking and
compiler options 47, 53 .KB files 15 embedding)
precompiled headers 218 Keep Selection property 165 linking resources to
input Key Value command applications 135, 142, 184
TTY devices 215 (resources) 180 list boxes 152
input messages keyboard properties, setting 165
controls 165 moving controls 155 lists
Insert mode (IDE) 9 resizing controls 156 expanding/contracting 14, 20
Inspect Expression window 105 keyboard mapping files 15 AppExpert 62
Inspect Object command 105 keyboard shortcuts sorting 165, 166
inspecting data 105 adding to menus 173, 174, literal strings
Inspector windows 105–106 175–176 compiler options 45, 49
installation IDE windows 15 Load Symbol Table
custom controls 153 command 109
hardware requirements 2 L Load Symbol Table dialog
box 109
software requirements 2
instance variables 76, 80 -L compiler option 44 loading files See files, opening
renaming 83 /l linker option 57 Local Edit property 150
instantiation Language command local overrides (Style Sheets) 35,
templates 54 (resources) 140 39–40, 41
instructions languages undoing 39
assembler See assembly extensions, conforming 46 local symbols 86–87
language large memory models local variables 47
integers compiler options, setting 49 local virtual tables 53
See also numbers Left property 161 Locate Function command 108
watches and 102, 104 libraries log files 108
compiler options 44

Index 281
adding comments 122 Member Pointer option (Project Help compiler 222
tracking exceptions 122–126 Options) 52 input
logging expressions 100, 108 memory controls 165
logging messages 108 allocation logging 108
logic errors 90 resources 139, 184, 211 saving WinSight 116
logical addresses 123 dump 104 tracing 112, 113, 115–120
loops location, watching 104 Messages option (Project
debugging 100 memory addresses Options) 54
pointers 104 metafiles 205
M Memory Model option (Project
Options) 49
Minimize Box property 150
minimize boxes
/M linker option 56 memory models main windows 71
/m linker option 56 See also specific model -ml compiler option 49
machine instructions See compiler options 49 -mm compiler option 49
instructions specifying 22 -mm! compiler option 49
machine-dependent Memory Options command modal dialog boxes 170
constructs 222 (resources) 139 Modal Frame property 150
macros menu bars 172–173 modes
defining 45 menu commands debugging 109
MAKE See MAKE adding to menus 173–176 memory 55
precompiled headers and 218 associating with module definition files
undefining 45 shortcuts 174, 175–176 case sensitivity 55
main windows checking for duplicate modules
AppExpert options 69, 71 names 177 compiling large 217
dialog boxes as 61, 149 display options 174 debugging information
disabling at startup 71 flashing 175, 176 and 91
.MAK files See makefiles Help text and 175 linking 55
MAKE manipulating 176 sharing objects 49
autodependency viewing 172 tracing into 125
information 46 Menu editor (resources) 171–172 moving controls 155, 156
building vs. 41 customizing 178 moving through Message
Make All command (Project) 41 starting 171 window 43
Make option (Project Menu property 149 moving through source code 93–
Options) 58 menus 171 95
makefiles adding to menu bars 172–173 single stepping 93
errors 221, 222 associating with -ms compiler option 49
mangled names 45 shortcuts 173 -ms! compiler option 49
linking and 56 creating See Menu editor Multi Column property 166
manifest constants See macros deleting 176 multiple controls, selecting 154
map files 56 dialog boxes 149 multiple Help files, searching 4
adding symbols 56 editing scripts 171–172 multiple inheritance 52
creating 128 floating 177 Multiple Select property 165
suppressing build 56 IDE 8
multiple-document interface
viewing code 57 moving 176
separators 173, 174 applications See MDI
Maximize Box property 150 applications
maximize boxes source code for 181–182
testing 177, 178 multitasking
main windows 71 debugger and 109
MDI applications 61, 68 viewing 172
merging duplicate strings 45 MULTITRG.IDE 25
AppExpert options 72, 73
medium memory models Message Trace Options dialog
compiler options, setting 49 box 116 N
member functions Message window 42 -N compiler option 47
debugging 95 messages -n compiler option 44
inline See also notification messages; /n linker option 55
compiler options 53 prompts
names
expansion 47 command-line options 54
See also identifiers
precompiled headers 218 error See error messages

282 User’s Guide


conflicting 46 octal numbers Owner Drawing property 161
mangled 45 resources and 212
linking and 56
New AppExpert Project dialog
OEM character sets 165, 166 P
OEM Conversion property 166
box 62 OLE applications 69 /P linker option 55
New Image command online help 3–4 -p compiler option 48
(resources) 195 AppExpert 63 packing code segments 55
New Menu Item command building 61, 69 pages
(resources) 174 compiler messages 222 alignment 57
New Popup command menu commands, Paint Can tool (resources) 191
(resources) 173 building 175 Paint Pattern tool
New Project command Open command (Project) 41 (resources) 190
(Project) 21 Open Detail command (Spy) 112 paint patterns (resources) 190
New Target command Open Project command painting 190, 200
(Project) 25 (Project) 24, 27 controls 149
New Target dialog box 21 OpenHelp tool 4 windows 71
adding targets 25 opening files palettes
setting target options 21–23 backward compatible 27 disabling 200
newline character (\r) project 41 resources See specific editor
static controls 163 opening windows parameters
No Character Underlining Breakpoints 97 See also arguments
property 161 Call Stack 107 functions with no 47
No Idle Messages property 150 Edit 10 Parent Notify property 153, 161
Node Attributes dialog box 24 Event Log 108 parsing header files 217
nodes Project 24 Pascal
Project Manager See Project Register 106 calling conventions
Tree Watch 101 compiler options 48
non-GUI classes 77 operating system See system debugging programs 95
nonzero values optimization 55 pass counts 99
variables 46 far calls, inhibiting 57 See also debugging
notebook tabs 153 floating-point operations 46 viewing 97
notification messages large programs 217 Pass Keyboard Input
dialog boxes 153, 161 precompiled headers 219– property 166
Notify property 165 220 Password property 165
null characters registers 45 passwords 165
resource scripts 212 options paths See directory paths
numbers See also command-line options Pause Program command 95
See also constants; integers AppExpert 68–74 pausing program execution 95,
resources and 212 specifying 64 99
ClassExpert 76, 77 -pc compiler option 48
projects 35
O changing 28
Pen Style tool (resources) 189
pens 189
.OBJ files See object files defaults, setting 58 performance See optimization
inheriting 36, 38
object files photographs, scanning 196
viewing 40
debugging information 47 Pick Rectangle tool
WinSpector 121
including line numbers 47 (resources) 192
Options command (IDE) 8
Object Linking and Embedding platforms
Options Hierarchy dialog box 40
See OLE See also DOS; Windows
out-of-date nodes 41
objects 90 programs
output
browsing through setting 21
logging messages 108
hierarchies 86 plus sign (+)
compiler options 49 testing 90
TTY devices 215 AppExpert hierarchies 62
dynamic 54 -po compiler option 45
sharing 49 watching program 91
overflow 47 pointers
ObjectWindows applications 61 derived classes 52
adding classes 76 Overwrite mode (IDE) 9
far
Owner Draw property 161

Index 283
compiler options 49, 50 crashing 108 project nodes (IDE) 20
huge debugging See debugging See also Project Tree
compiler options 50 execution Project Options dialog box 36
memory addresses 104 controlling 90, 92–96 setting options 43
suspicious 49 pausing 95, 99 Project Style Sheet 36
pop-up windows 147 terminating 95 settings, overriding 36
See also dialog boxes external 95 Project Tree 20–21
drawing 149 failing 89 See also Project Manager
frames 167 history, recording 108 expanding/contracting
menus 149 implementation, problems lists 20
overlapping 151 with 90 nodes
properties 149–151 large 217 adding 24, 25, 42
-pr compiler option 49 linking See linkage compiling 29
#pragma directives running 13 copying 26–27
precompiled headers from the IDE 18 deleting 24, 26, 27
and 218, 219 in the IDE 91–92 editing 24, 26
precompiled headers 217–220 to breakpoints 95 moving 26
compiler options 48, 218, 219 to specific locations 92 option settings 35
optimizing 219–220 single-source 13 out-of-date 41
storing 217, 218 stepping through 93–95 referencing 29
warnings 218 single stepping 93 specifying 23
Precompiled Headers option testing 10, 90, 104 Style Sheets 36, 39
(Project Options) 48 tracing into 125 translating 24, 30, 41, 42
type, setting 11, 12 types, defined 20
predefined colors
watching 91 viewing 28
Project Manager 20 settings 40
syntax highlighting 15 Project command (IDE) 8
Project command (Options) 36 Project View options 28
predefined resources 153, 172,
Project command (View) 24 Project window
211 customizing 28
predefined Style Sheets project files 62, 69
See also projects generating symbolic debug
attaching to nodes 36 information 91
backward compatibility 27
preferences (IDE) 17 opening 24
browsing 85
Preferences command SpeedBar buttons 9
including debug
(Environment) 43 information 91 viewing resources 144
preserving IDE error opening 41 project-manager utility See
messages 43 rearranging in IDE 26 MAKE
printing 68 targets 36 projects
WinSight messages 116 adding 25 See also project files; Project
printing conventions changing defaults 21 Manager
(documentation) 3 defining multiple 29 adding source files 24
.PRJ files 27 deleting 26 building 41
Processor option (Project dependent files 20 parts of 42
Options) 48 setting options 21–23 canceling builds 41
program files updating 29, 41 compiling See compilation
adding to Tool menu 31 testing 10 creating new 21–23, 36, 58
creating new 10 viewing 20 importing earlier versions 27
DOS platforms 11 Project Manager (IDE) 19, 20–29 linking See linkage
Windows platforms 12 adding files 24 managing 19
default 10 creating projects 21–23, 36 options 35
status in Edit window 10 glyphs 21 changing 28
program group 7 loading preexisting project inheriting 36, 38
Program Manager files 27 setting defaults 58
Resource Workshop, starting Project Tree See Project Tree viewing 40
from 135 setting target options 21–23 sample
programs SpeedMenus 9 multi-targets 25
See also DOS programs; Style Sheets See Style Sheets Source Pools 30
Windows programs translators, specifying 25, 30 Style Sheets 36
compiling See compilation Project menu 41 setting up 10

284 User’s Guide


prompts 183 resizing main windows 71 linking to applications 135,
properties resource script files 135–142 142, 184
bitmaps 196 adding scripts 137 naming 136, 140–142
breakpoints 98–100 binary 142–143 accelerators 179
cursors 196 changing 136 controls 161
dialog boxes 149–151, 160– compiling and linking 142, predefined 153, 172, 211
168 212 renaming 83
fonts 197–199 creating 136 retrieving information on 82
frame windows 77 identifiers 140–141 setting version 206–211, 213
icons 197 resource scripts 135, 137–140 header file 208
Properties window changing 138, 141 testing 168, 177, 178, 195
(resources) 160 controls 169 tools 148, 152, 188
proportionally-spaced fonts 199 copying and moving 138 disabling 200
public definitions 53 creating new 137, 138 transfer buffers 80
public symbols 55, 56 customizing resources 206– types 134
push buttons 152, 162 212 user-defined 205–214
properties, setting 162–163 deleting 140, 141 viewing 144, 194
entering data 212 multiple images 199
Resource Workshop 62, 133 Resources option (Project
R ClassExpert and 81 Options) 58
-R compiler option 47 custom data types 205, 206, restarting programs (integrated
-r compiler option 46 211–212, 213 debugger) 95
radio buttons 152 customizing 144–145 restoring defaults
properties, setting 163 editors 135–136, 138 IDE SpeedBars 17
.RC files accelerators 178 rich-text formats 222
See also resource script files customizing 169, 178, 185, files, generating 69
-rd compiler option 45 199–201 right-align character (\a) 173,
reconfiguring the IDE 14–17 dialog boxes 147–149 174
rectangle controls 167 graphics 187–188 RLE compression algorithm 196
menus 171–172 RLINK.EXE
rectangles, drawing 191 scripts 206–212
redistributable files ii See also resource linkers
string tables 183 RLINK32.DLL
referencing/dereferencing error messages 183, 213
templates 54 See also resource linkers
installing custom controls 153 rounded rectangles,
virtual tables 53 starting 135
Register command 106 drawing 191
Resource Workshop command routines
register keyword 45 (Tool) 135
register variables drawing 149
resources 135 .RSP files See response files
compiler options 45 See also specific types
registers 49 -RT compiler option 54
allocating memory 139, 184,
CPU, checking values 106 .RTF files 222
211
optimizing 45 generating 69
associating with classes 75, 80
tracing into 124 compiling See resource RTTI 54
registers calling convention 49 compilers RTTI option (Project Options) 54
Registers window 106 defined 134 Run command (Debug) 13
Remove All Messages option 43 drawing routines 149 Run To Cursor button 92
Rename option (Style Sheets) 38 editing 135, 138, 141, 206 Run to Cursor command 92
renaming Style Sheets 38 in binary files 142 run-time errors 89–90, 222
repainting windows 71 in graphics files 144 run-time nodes (IDE) 20
repeat counts 102, 104 in script files 136 run-time type information See
See also watches generating binary 142 RTTI
.RES files header files 141, 142
See also resource script files identifiers 184
changing 178, 181, 184
S
Rescan 65, 82–83
moving classes 82, 83 duplicate, checking /s linker option 56
resizing characters 198 for 177 sample projects
resizing controls 155–156 international versions 139– multi-targets 25
140, 209–210 Source Pools 30

Index 285
Style Sheets 36 Set Groups command editing
Save Events To File (resources) 157 Breakpoints window 97
command 108 Set Groups tool (resources) 157 Call Stack window 107
Save Resource As command Set Hot Spot command generating with
(resources) 138 (resources) 197 AppExpert 64, 70
saving Set Options command 108 graphics 201–203
IDE settings 17 Set Or Clear An Unconditional machine-dependent
window settings 17 Breakpoint button 96 constructs 222
scalars, inspecting 105 Set Order tool (resources) 157 menus 181–182
scanned photographs 196 moving through 93–95
Set Range command 106
Scissors tool (resources) 193 single stepping 93
Set Watch command 101 viewing 76, 81, 91, 97, 107
screens SetCursor member function
flickering, eliminating 91 source files 19
TWindow 202 accessing 21
resolution 194 SetIcon member function
Script editor (resources) 206–212 adding to projects 24
TFrameWindow 202 Edit window 21, 43
starting 206 setting breakpoints 95, 96–97 fixing errors 43
Scroll Bar Always property 166 after program start 96 rearranging in IDE 26
scroll bars 164 setting watches 101 viewing 21
combo boxes 166 settings WinSpector reports 127
dialog boxes 152, 161 reconfiguring IDE 15–17 source nodes (IDE) 20
list boxes 166 resources See properties See also Project Tree
main windows 71 saving IDE 17 adding 24
SDI applications 61, 68, 72 window 17 attributes 24
creating 62 shapes, drawing 191 deleting 24
Search command (IDE) 8 shortcuts referencing 29
search operations compiler options 41 specifying 23
online help 4 keyboard translating 24
symbols 88 adding to menus 173, 174, viewing 28
search paths See directory paths 175–176 Source option (Project
Second Graphic command IDE windows 15 Options) 46
(resources) 178 Show Palette command Source Pools 29–30
Segment Names Data option (resources) 200 compiling nodes 29
(Project Options) 50 Show Project Node option 20 creating 29
segments Show Properties command Special command
code See code segments (resources) 160 (SpeedMenu) 31
compiler options 50–51 Show Toolbox command SpeedBars (IDE) 9
data See data segments (resources) 200 customizing 16
detailed maps 56 single-document interface hiding 16
renaming 50–51 applications See SDI SpeedMenus
trailing 57 applications AppExpert 62
Selected Classes command single-source programs 13 ClassExpert 76
(Messages) 113 Size and Attributes command IDE 9, 31
Selected Windows command (resources) 196, 197 adding tools 32
(Messages) 115 Size command (resources) 155 Split Horizontal command
Selector tool (resources) 154 Size Controls dialog box 155, 156 (resourcers) 200
separators small memory models Split Vertical command
dialog boxes 152 compiler options, setting 49 (resourcers) 200
menus 173, 174 software 2 spying on classes 113
deleting 176 Sort property 165, 166 spying on windows 115
moving 176 source code squares, drawing 191
viewing 172 accelerators 181–182 SRCPOOL.IDE 30
servers (automation) 70 debugging 91, 92, 104 stack
servers (linking and breakpoints and 96 IDE options 22
embedding) 70 execution point 93, 100, overflow 47
Set Grid Attributes dialog 107 tracing into 47, 122, 124, 127
box 159 dialog boxes 170

286 User’s Guide


Standard Libraries options Style Sheets command tabs (notebook) 153
(IDE) 22 (Options) 36 target files 19
Start! command (WinSight) 112 Style Sheets dialog box 36 Target Model options (IDE) 22
starting options 37–38 target nodes (IDE) 20
AppExpert 62 Style window (Dialog See also Project Tree
ClassExpert 75 editor) 161–168 adding 25
IDE browser 85, 86 styles attributes 26
OpenHelp 4 dialog boxes 150, 151 deleting 26
Resource Workshop 135 document types 78 multiple 29
WinSight 111 pens 189 types, defined 25
WinSpector 121 STYLESHT.IDE 36 updating 29
statements subroutines viewing 28
checking 90 debugging 47 target platforms
debugging 92, 93, 100 suspicious pointers 49 See also DOS; Windows
static text controls 152 switches See command-line programs
character underlining 161 options setting 21
new lines 163 .SYM files 124, 128 TargetExpert 22
properties, setting 163 symbol tables 91, 217 editing target attributes 26
status bars 68, 175 adding to files 91 TargetExpert dialog box 26
IDE 9 loading 109 targets See makefiles; project files
status flags 106 symbolic addresses 56 TBitmap class 201
Step Over button 94 symbolic browser TClientDC class 201
Step Over command 94 information 85 TDialog class 170
stepping through programs 93– symbolic constants See macros TDibDC class 201
95 symbolic debug information 91, TDip class 201
single stepping 93 93 technical support 4
Stop! command (WinSight) 112 See also symbol tables TEditView class 78
stopping compilation 55 DLLs and 109 template classes
stopping program execution symbols 55 compiler options 53
(integrated debugger) 95, 99, case 55 instances, duplicating 54
108 idle 56 referencing/dereferencing 54
String editor (resources) 183 public 56 Templates option (Project
customizing 185 searching for 88 Options) 53
string resources See string tables viewing 86–87 temporary files 44
string tables 175, 183–185 syntax Terminate Program
adding to scripts 183 format specifiers command 95, 108
allocating memory 184 watches 102 terminating programs 95
changing 184 syntax errors (defined) 42 Test Dialog command
strings Syntax Highlighting option 15 (resources) 168
including in resource system information, Test tool (resources) 168
scripts 212 returning 126 testing
literal System menu applications 30, 91
compiler options 45, 49 adding to main window 71 program setup 10
structures 50 System Menu property 150 programs 90, 104
debugging 104 System Modal property 150 resources 168, 177, 178, 195
inspecting 105 text 183
watching 104
Style Sheets 36–41
T adding to graphics 192
aligning 192
copying 38 tab character (\t) in controls 161, 163
creating 37 menus 173, 174 colors 192
defined 35 static controls 163 Text Edit command (View) 21
deleting 38 Tab Stop property 161 text editors 10
editing 38, 41 Tab Stops property 165 reconfiguring IDE 15
overriding 35, 39–40, 41 tabbing through controls 157 resource scripts 135–136, 206
scope 38 tables text strings See strings
sharing 38–39 virtual 49, 51, 53 Text tool (resources) 192
undoing overrides 39

Index 287
TFrameWindow class translating project nodes 24, 30, unions
creating icons 202 41, 42 watching 104
members translators 30 unrecoverable application
SetIcon 202 specifying 25 errors 120, 127
Thick Frame property 150 truncated identifiers 46 updating targets 29, 41
this pointer TTY devices 215 user interfaces
compiler options 45 Turbo Debugger 127 components 134
three-dimensional controls 153, Turbo Pascal See Pascal dialog boxes as main 61, 68
169 turning off testing 90
title bars breakpoints 97 user-defined resources 205–214
main windows 71 drawing tools 200 utilities See specific C++ utility
TLINK message tracing 112
See also TLINK32
ACBP fields and 56
palettes 200 V
syntax highlighting 16
compiler options 53 underscores 46 -V compiler option 53
errors 222 watches 102 -v compiler option 47
options 55 -tW compiler option 51 /v linker option 55
TListView class 78 -tWD compiler option 52 -V0 compiler option 53
TMAPSYM.EXE 128 -tWDE compiler option 52 -V1 compiler option 53
TMenu class 181 -tWE compiler option 51 values
Toggle Breakpoint command 96, TWindow class ACBP fields 56
98 creating cursors 202 changing 103, 104, 105
Tool command (IDE) 8 members checking 90, 91, 100
Tool menu SetCursor 202 CPU registers 106
adding files 31 TWindowView class 78 decimal
customizing 18 -tWS compiler option 52 watches and 102, 104
toolbars 68 -tWSE compiler option 52 expressions, viewing 101
TOOLHELP.DLL 121 Type property 149, 151 floating-point
tools 30–33 check boxes 163 watches and 102, 104
adding to IDE 31–33 combo boxes 166 hexadecimal
adding to SpeedMenus 32 frames 167 watches and 102, 104
defined 30 group boxes 164 variables
Tools command (Options) 31 lines 167 See also environment variables
Tools dialog box 31 push buttons 162 communal 46, 50
Tools palette radio buttons 163 debugging 99, 103
Dialog editor 148, 152 rectangles 167 global 50
adding custom static text controls 163 initializing to nonzero
controls 154 typographic conventions values 46
Graphic editor 188 (documentation) 3 instance 76, 80
hiding 200 renaming 83
local 47
Top property 161 U register 45
Trace Into button 93
-u compiler option 46 values
Trace Into command 93–94 changing 103, 104
tracing into code 93–94, 107 UAEs 120
multiple 127 checking 90, 91, 100
See also debugging variable-width fonts 197, 198
DLLs and 109 undefined watches 101
undefining macros 45 ver.h 208
tracing messages verbose stack trace 122, 127
(WinSight) 112, 113, 115 underbars See underscores
underscores 46 version compatibility
Track Test Menu command loading project files 27
(resources) 178 Undo command (Edit) 10
version information
trailing segments, Undo command (resources) 160
(resources) 206–211, 213
uninitialized 57 undocumented Windows
header file 208
transfer buffers messages 116
version numbers 70
resources 80 uninitialized data segments 50
Vertical Scroll Always
transfer macros 31 uninitialized trailing
property 166
segments 57
Vertical Scroll Bar property 161

288 User’s Guide


vertical scroll bars 164 -Vmv compiler option 52 Message 42
dialog boxes 152, 161 -Vs compiler option 53 opening
main windows 71 Breakpoints 97
Vertical Scroll property 150 W Call Stack 107
Event Log 108
-Vf compiler option 49
-vi compiler option 47 -W compiler option 51 Register 106
View As Popup command -w compiler option 55 Watch 101
(resources) 178 warnings 43, 222 painting 71
View Breakpoint command 97 compiler 54 pop-up See pop-up windows
displaying 55 retrieving information on 111
View command (IDE) 8
ignoring 13 saving settings 17
View menu 89 viewing current 114–115
View Options Hierarchy precompiled headers 218
viewing 55 Windows 3.1 Style property 164
command (IDE) 40 Windows API calls
View Source command 97, 107 Watch command 101
watch expressions See watches resources 170, 181, 203
viewers 30 Windows applications 183
AppExpert targets 75 Watch Properties dialog box 101
settings, losing 102 32-bit executables
defined 30 compiler options 51
resources 81 Watch window 101
opening 101 creating 61, 68
viewing 106 debugging 109, 111, 128
arguments 107 updating 101
watches 101–103 IDE options 22, 23
breakpoints 97, 100 main window 69, 71
classes 75, 76 See also debugging
deleting 103 resources See resources
current windows 114–115 Windows classes (controls) 160
executable files 85 disabling 102
formatting 102, 104 Windows functions
expressions 101 accelerators 181
function calls 107 undefined 101
-WC compiler option 51 compiler options 51
IDE errors 42, 43 dialog boxes 170
pass counts 97 -WD compiler option 52
-WDE compiler option 52 exportable 51
project files 20 menus 181
project nodes 28 -WE compiler option 51
Width property 161 Windows messages
settings 40
wildcards dialog boxes 153, 161
resources 144, 194
multiple images 199 AppExpert 74 tracing 112, 113, 115–120
source code 91, 97, 107 ClassExpert 78 Windows programs 109, 123
ClassExpert window 76, search expressions converting DOS programs
81 browser 88 to 215–216
source files 21 WIN_TEST.IDE 12 creating 12–13
status flags 106 Win32 applications See Windows running 13
symbols 86–87 system information 126
applications, 32-bit executables
warnings 55 WinSight 111–120
window classes
WinSight messages 112–113 class lists 113
creating 67
WinSpector reports 122 exiting 112
currently registered 113
virtual functions 75, 76 locating windows 114
retrieving information on 111
compiler options 49 printing messages 116
Window command (IDE) 8 saving messages 116
event handlers 79 Window messages 109
virtual keys 175, 176 starting 111
windows tracing messages 112, 113,
virtual tables 49, 51, 53 child 114
referencing/dereferencing 53 115–120
AppExpert options 71, 73 viewing messages 112–113
Virtual Tables option (Project client windows hierarchy lists 114–
Options) 53 AppExpert options 72 115
Visible property 150, 161 frame WinSight window 111
visual application generation 61 properties, setting 77
choosing views 112
Visual Basic controls 153 IDE See specific window
main WINSPCTR.BIN 121, 122, 126
Visual Solutions Pack 153 DFA utility and 127
-Vmm compiler option 52 AppExpert options 69, 71
dialog boxes as 61, 149 WINSPCTR.INI, editing 121
-Vmp compiler option 52 WINSPCTR.LOG 121, 122–126
-Vms compiler option 53 disabling at startup 71

Index 289
configuring 121 Zoom In command
DFA utility and 127 (resources) 194
WinSpector 120–129 Zoom Out command
adding source files to (resources) 194
reports 127 Zoom tool (resources) 194
appending new reports 121 -zP compiler option 51
exception types 122 -zR compiler option 50
heap information 126 -zS compiler option 50
including line numbers in -zV compiler option 51
reports 127 -zW compiler option 51
listing functions 124
locating last message
received 124
modules list 125
options 121
overwriting previous
reports 121
processing data 126–128
program lists 125
reading log file 122–126
setting preferences 121
stack pointer 123
starting 121
system information
returning 126
tracing into stack 124
utilities 128–129
viewing reports 122
word alignment 48
word-processor documents 143,
153
-WS compiler option 52
-WSE compiler option 52
-w-xxx compiler option 55
-wxxx compiler option 55

X
-X compiler option 46
-x compiler option 54
/x linker option 56
-xd compiler option 54
-xp compiler option 54

Y
-y compiler option 47

Z
-zA compiler option 51
-zB compiler option 50
-zC compiler option 51
-zD compiler option 50
-zE compiler option 50
-zF compiler option 51
-zH compiler option 51

290 User’s Guide


User’s Guide
User’s Guide

®
VERSION 4.5 Turbo C ++
Borland International, Inc., 100 Borland Way
P.O. Box 660001, Scotts Valley, CA 95067-0001
Redistributable files
You can redistribute the following files in accordance with the terms of the No-Nonsense License Statement:

• BC450RTL.DLL • BIVBX11N.EXE • OWL250.DLL


• BIDS45.DLL • BIVBX11S.DLL • PICT.VBX
• BIVBX11.DLL • BOCOLE.DLL • BWCC000C.DLL
• BWCC.DLL • GAUGE.VBX • SWITCH.VBX
• BIVBX11C.DLL • BWCC0009.DLL • LOCALE.BLL

Refer to the file REDIST.TXT in the \TCWIN45\DOC directory for a complete list of files that you can redistribute in
accordance with the No-Nonsense License Statement.
Borland may have patents and/or pending patent applications covering subject matter in this document. The
furnishing of this document does not give you any license to these patents.
COPYRIGHT © 1987, 1995 Borland International. All rights reserved. All Borland products are trademarks or
registered trademarks of Borland International, Inc. Other brand and product names are trademarks or registered
trademarks of their respective holders.
Printed in the U.S.A.
1E0R1094
9495969798-9 8 7 6 5 4 3 2 1
H1
Contents
Introduction 1 Deleting target nodes . . . . . . . . . . . . . . 25
Editing target attributes using TargetExpert. . 26
What’s new in Turbo C++. . . . . . . . . . . . . .1 Moving nodes within a project . . . . . . . . . 26
Hardware and software requirements . . . . . .2 Copying nodes in a project . . . . . . . . . . . . 26
Manual conventions . . . . . . . . . . . . . . . . .3 Importing projects from older versions of
Getting help . . . . . . . . . . . . . . . . . . . . . .3 Turbo C++ . . . . . . . . . . . . . . . . . . . . 27
Searching through multiple Help files with Importing projects from Borland C++ . . . . . 27
OpenHelp . . . . . . . . . . . . . . . . . . . . . .4 Customizing the Project window . . . . . . . . 28
Software registration and technical support . . . 4 Grouping sets of files with Source Pools . . . . 29
Creating a Source Pool . . . . . . . . . . . . . . 29
Part I Translators, viewers, and tools . . . . . . . . . . 30
Using the integrated development Adding translators, viewers, and tools to the
IDE . . . . . . . . . . . . . . . . . . . . . . . . . 31
environment 5
Chapter 3
Chapter 1 Specifying project options and
Getting started 7 compiling 35
Starting the Turbo C++ IDE. . . . . . . . . . . . . 7 Setting project options . . . . . . . . . . . . . . . 35
The IDE menu system . . . . . . . . . . . . . . . .8 Using Style Sheets . . . . . . . . . . . . . . . . . 35
The IDE SpeedBar . . . . . . . . . . . . . . . . . .9 Predefined Style Sheets . . . . . . . . . . . . . 36
Using SpeedMenus in the IDE . . . . . . . . . . . 9 The default project options . . . . . . . . . . . 36
Using the Edit window . . . . . . . . . . . . . . . 9 Managing Style Sheets. . . . . . . . . . . . . . 37
Creating a new file . . . . . . . . . . . . . . . . . 10 Attaching Style Sheets to a node . . . . . . . . 38
Working with simple projects . . . . . . . . . . 10 Sharing Style Sheets between projects . . . . . 38
Creating an EasyWin Program . . . . . . . . . . 11 Setting local overrides. . . . . . . . . . . . . . . 39
Creating a Windows program . . . . . . . . . . 12 Viewing project options . . . . . . . . . . . . . . 40
Single file programs . . . . . . . . . . . . . . . . 13 Compiling projects . . . . . . . . . . . . . . . . . 41
Customizing the IDE . . . . . . . . . . . . . . . . 14 Compiling part of a project. . . . . . . . . . . . 42
Configuring the IDE editor . . . . . . . . . . . . 15 Fixing compile-time errors. . . . . . . . . . . . . 42
Syntax highlighting. . . . . . . . . . . . . . . . . 15 Viewing errors . . . . . . . . . . . . . . . . . . . 43
Customizing the SpeedBars. . . . . . . . . . . . 16 Fixing errors . . . . . . . . . . . . . . . . . . . . 43
Setting IDE preferences . . . . . . . . . . . . . . 17 Project options reference . . . . . . . . . . . . . . 43
Saving your IDE settings . . . . . . . . . . . . . 17 Directories. . . . . . . . . . . . . . . . . . . . . . 43
Running other programs from the IDE . . . . . 18 File-search algorithms . . . . . . . . . . . . . . 44
Compiler . . . . . . . . . . . . . . . . . . . . . . 44
Chapter 2 Defines . . . . . . . . . . . . . . . . . . . . . . . 45
Code generation . . . . . . . . . . . . . . . . . 45
Creating and managing projects 19 Floating Point . . . . . . . . . . . . . . . . . . . 46
What is project management? . . . . . . . . . . 19 Compiler Output . . . . . . . . . . . . . . . . . 46
Using the Project Manager . . . . . . . . . . . . 20 Source . . . . . . . . . . . . . . . . . . . . . . . 46
Creating a project . . . . . . . . . . . . . . . . . . 21 Debugging. . . . . . . . . . . . . . . . . . . . . 47
Setting target options with the New Target Precompiled headers. . . . . . . . . . . . . . . 48
dialog box . . . . . . . . . . . . . . . . . . . . 21 Advanced Compiler. . . . . . . . . . . . . . . . 48
Specifying the source node types . . . . . . . 23 Processor. . . . . . . . . . . . . . . . . . . . . . 48
Opening existing projects . . . . . . . . . . . . 24 Calling Convention. . . . . . . . . . . . . . . . 48
Adding source nodes to your project . . . . . . 24 Memory Model . . . . . . . . . . . . . . . . . . 49
Deleting source nodes . . . . . . . . . . . . . . 24 Segment Names Data . . . . . . . . . . . . . . 50
Editing source node attributes . . . . . . . . . . 24 Segment Names Far Data . . . . . . . . . . . . 50
Adding target nodes to your project. . . . . . . 25 Segment Names Code . . . . . . . . . . . . . . 51

i
Entry/Exit Code . . . . . . . . . . . . . . . . . 51 Deleting a class . . . . . . . . . . . . . . . . . . . 82
C++ Options. . . . . . . . . . . . . . . . . . . . . 52 Moving a class . . . . . . . . . . . . . . . . . . . 82
Member Pointer . . . . . . . . . . . . . . . . . 52 Renaming an element . . . . . . . . . . . . . . . 83
C++ Compatibility . . . . . . . . . . . . . . . . 53 Importing a class . . . . . . . . . . . . . . . . . . 83
Virtual Tables . . . . . . . . . . . . . . . . . . . 53 Rebuilding the .APX database file. . . . . . . . 83
Templates . . . . . . . . . . . . . . . . . . . . . 53
Exception handling/RTTI . . . . . . . . . . . 54 Chapter 6
Messages . . . . . . . . . . . . . . . . . . . . . . . 54 Browsing classes and objects 85
Linker. . . . . . . . . . . . . . . . . . . . . . . . . 55
General . . . . . . . . . . . . . . . . . . . . . . 55 Generating browser information . . . . . . . . . 85
Map File . . . . . . . . . . . . . . . . . . . . . . 56 Browsing objects (class overview) . . . . . . . . 86
Advanced Linker. . . . . . . . . . . . . . . . . 57 Browsing global and local symbols . . . . . . . 86
Other Project Options dialog box options. . . . 58 Configuring the browser display . . . . . . . . . 87
Option defaults . . . . . . . . . . . . . . . . . . . 58 Using regular expressions with global
symbols . . . . . . . . . . . . . . . . . . . . . . . 88
Chapter 4 Customizing the browser . . . . . . . . . . . . . 88
Building applications with AppExpert 61
AppExpert basics . . . . . . . . . . . . . . . . . . 62 Chapter 7
Creating a small application . . . . . . . . . . . 62 Using the integrated debugger 89
Overview of the generated code . . . . . . . . . 64 Types of bugs . . . . . . . . . . . . . . . . . . . . 89
The application object . . . . . . . . . . . . . . 64 Run-time errors . . . . . . . . . . . . . . . . . . 89
The client window . . . . . . . . . . . . . . . . 67 Logic errors . . . . . . . . . . . . . . . . . . . . . 90
AppExpert options reference . . . . . . . . . . . 68 Planning a debugging strategy . . . . . . . . . . 90
Application . . . . . . . . . . . . . . . . . . . . . 68
Starting a debugging session . . . . . . . . . . . 90
Basic Options . . . . . . . . . . . . . . . . . . . 68
OLE 2 Options . . . . . . . . . . . . . . . . . . 69 Compiling with debug information. . . . . . . 91
Code Gen Control . . . . . . . . . . . . . . . . 70 Running your program in the IDE . . . . . . . 91
Admin Options. . . . . . . . . . . . . . . . . . 70 Specifying program arguments . . . . . . . . 92
Main Window. . . . . . . . . . . . . . . . . . . . 71 Controlling program execution . . . . . . . . . . 92
Basic Options . . . . . . . . . . . . . . . . . . . 71 Running to the cursor location. . . . . . . . . . 92
SDI Client . . . . . . . . . . . . . . . . . . . . . 72 The execution point . . . . . . . . . . . . . . . . 93
MDI Client . . . . . . . . . . . . . . . . . . . . 72 Finding the execution point. . . . . . . . . . . 93
Dialog Client . . . . . . . . . . . . . . . . . . . 73 Stepping through code . . . . . . . . . . . . . . 93
MDI Child/View . . . . . . . . . . . . . . . . . . 73 Trace Into . . . . . . . . . . . . . . . . . . . . . 93
Basic Options . . . . . . . . . . . . . . . . . . . 74 Step Over . . . . . . . . . . . . . . . . . . . . . 94
Debugging member functions and external
Chapter 5 code. . . . . . . . . . . . . . . . . . . . . . . . 95
Running to a breakpoint . . . . . . . . . . . . . 95
Modifying applications with Pausing the program . . . . . . . . . . . . . . . 95
ClassExpert 75 Terminating the program. . . . . . . . . . . . . 95
Starting ClassExpert . . . . . . . . . . . . . . . . 75 Using breakpoints. . . . . . . . . . . . . . . . . . 96
ClassExpert basics . . . . . . . . . . . . . . . . . 76 Setting breakpoints . . . . . . . . . . . . . . . . 96
Classes pane . . . . . . . . . . . . . . . . . . . 76 Setting breakpoints after starting a program . 96
Events pane . . . . . . . . . . . . . . . . . . . . 76 Invalid breakpoints. . . . . . . . . . . . . . . . 97
Edit pane . . . . . . . . . . . . . . . . . . . . . 76 Working with breakpoints . . . . . . . . . . . . 97
Adding a class. . . . . . . . . . . . . . . . . . . . 76 Viewing and editing code at a breakpoint . . 97
Creating document types . . . . . . . . . . . . . 78 Disabling and enabling breakpoints . . . . . . 97
Adding and deleting event handlers . . . . . . 79 Deleting breakpoints . . . . . . . . . . . . . . . 98
Adding and deleting instance variables. . . . . 80 Modifying breakpoint properties. . . . . . . . . 98
Jumping to class source code . . . . . . . . . . . 81 Creating conditional breakpoints . . . . . . . . 99
Using Resource Workshop with ClassExpert . 81 Setting Boolean conditions . . . . . . . . . . . 99
Running Resource Workshop from the IDE . . 81 Using pass counts . . . . . . . . . . . . . . . . 99
Using Rescan . . . . . . . . . . . . . . . . . . . . 82 Logging expressions. . . . . . . . . . . . . . . .100

ii
Customizing the breakpoint and execution Other WinSpector tools . . . . . . . . . . . . . 128
point colors . . . . . . . . . . . . . . . . . . . 100 Using EXEMAP.EXE . . . . . . . . . . . . . . .128
Examining program data values . . . . . . . . 100 Using TMAPSYM.EXE . . . . . . . . . . . . . .128
Watching expressions . . . . . . . . . . . . . . 101 Using BUILDSYM.EXE . . . . . . . . . . . . . .129
Formatting watch expressions . . . . . . . . . 102
Disabling a watch . . . . . . . . . . . . . . . . 102 Part II
Deleting a watch . . . . . . . . . . . . . . . . . 103 Using Resource Workshop 131
Evaluating and modifying expressions . . . . 103
Evaluating expressions . . . . . . . . . . . . . 103
Modifying the values of variables . . . . . . . 104 Chapter 9
Inspecting data elements . . . . . . . . . . . . 105 An overview of working
Examining register values. . . . . . . . . . . . 106
Viewing function calls . . . . . . . . . . . . . . 107
with resources 133
Navigating to function calls. . . . . . . . . . . 107 What is a resource? . . . . . . . . . . . . . . . . 134
Locating functions . . . . . . . . . . . . . . . . 108 Why you should link resources to your
Catching general protection faults . . . . . . . 108 applications. . . . . . . . . . . . . . . . . . . . 135
Sending messages to the Event Log window 108 Starting Resource Workshop . . . . . . . . . . 135
Debugging dynamic-link libraries . . . . . . . 109 Working with resource script files . . . . . . . 135
Debugging in soft and hard mode . . . . . . . 109 Creating a resource script file . . . . . . . . . .136
Editing an existing resource script file . . . . .136
Chapter 8 Adding resource scripts . . . . . . . . . . . . .137
Adding a new resource script indirectly . .137
WinSight and WinSpector 111 Adding one or more existing resource
WinSight . . . . . . . . . . . . . . . . . . . . . . 111 scripts indirectly . . . . . . . . . . . . . . .137
Starting and stopping screen updates . . . . . 112 Adding a new resource script directly . . .138
Turning off message tracing . . . . . . . . . . 112 Adding an existing resource script
directly . . . . . . . . . . . . . . . . . . . .138
Choosing a view . . . . . . . . . . . . . . . . . 112 Editing a resource script . . . . . . . . . . . . .138
Class List view. . . . . . . . . . . . . . . . . . . 113 Specifying memory options . . . . . . . . .139
Using the Class List view . . . . . . . . . . . . 113 Specifying a language version. . . . . . . .139
Spying on classes . . . . . . . . . . . . . . . . . 113 Removing a resource script . . . . . . . . . . .140
Window Tree view . . . . . . . . . . . . . . . . 114 Adding an identifier . . . . . . . . . . . . . . .140
Finding a window . . . . . . . . . . . . . . . . 114 Editing an identifier . . . . . . . . . . . . . . .141
Leaving Find Window mode. . . . . . . . . . 115 Removing an identifier . . . . . . . . . . . . .141
Spying on windows . . . . . . . . . . . . . . . 115 Generating binary resources from a resource
Choosing messages to trace . . . . . . . . . . . 115 script file. . . . . . . . . . . . . . . . . . . . . .142
Using the Message Trace view . . . . . . . . . 115 Working with binary files . . . . . . . . . . . . 142
Other tracing options . . . . . . . . . . . . . . 116 Creating a .RES file . . . . . . . . . . . . . . . .142
WinSpector. . . . . . . . . . . . . . . . . . . . . 120 Editing resources in a binary file . . . . . . . .142
Configuring WINSPCTR.LOG . . . . . . . . . 121 Working with graphic files . . . . . . . . . . . 143
WINSPCTR.LOG reference . . . . . . . . . . . 122 Creating a graphic file. . . . . . . . . . . . . . .143
Disassembly section . . . . . . . . . . . . . . . 123 Editing a graphic file . . . . . . . . . . . . . . .144
Stack Trace section . . . . . . . . . . . . . . . . 124 Customizing Resource Workshop . . . . . . . 144
Register section . . . . . . . . . . . . . . . . . . 124 Specifying which information appears in the
Message Queue section . . . . . . . . . . . . . 124 Project window. . . . . . . . . . . . . . . . . .144
Tasks section . . . . . . . . . . . . . . . . . . . 125 Setting general environment options . . . . . .144
Modules section . . . . . . . . . . . . . . . . . 125
USER and GDI heap section . . . . . . . . . . 126 Chapter 10
System Information section. . . . . . . . . . . 126 Working with dialog boxes 147
Processing WinSpector data. . . . . . . . . . . 126
DFA output . . . . . . . . . . . . . . . . . . . . 127
Editing a dialog box resource script . . . . . . 147
Setting dialog box properties. . . . . . . . . . .149
Using DFA with WINSPCTR.LOG . . . . . . 127
Class property. . . . . . . . . . . . . . . . . . .149
Using DFA with WINSPCTR.BIN . . . . . . . 127
Menu property . . . . . . . . . . . . . . . . . .149

iii
Type property . . . . . . . . . . . . . . . . . . 149 Line properties . . . . . . . . . . . . . . . . . .167
Style properties . . . . . . . . . . . . . . . . . . 150 Testing a dialog box resource . . . . . . . . . . 168
Frame Style property . . . . . . . . . . . . . . 150 Testing two dialog boxes at the same time. . .168
Font properties . . . . . . . . . . . . . . . . . . 150 Returning to Edit mode . . . . . . . . . . . . . .168
Extended Style property . . . . . . . . . . . . 151 Customizing the Dialog editor . . . . . . . . . 169
Common properties . . . . . . . . . . . . . . . 151
Moving and resizing a dialog box . . . . . . . 151 Using a dialog box resource in an application 170
Adding a standard control to a dialog box . . 151 Programming a dialog box with OWL . . . . .170
The advantages of using Borland controls . . 153 Programming a dialog box with the
Windows API. . . . . . . . . . . . . . . . . . .170
Working with custom controls . . . . . . . . . 153
Installing a control library (.DLL or .VBX) . . 153
Adding a custom control to a dialog box . . . 154
Chapter 11
Creating custom controls . . . . . . . . . . . . 154 Working with menus and
Selecting controls . . . . . . . . . . . . . . . . . 154 accelerator tables 171
Moving controls. . . . . . . . . . . . . . . . . . 155
Resizing controls . . . . . . . . . . . . . . . . . 155 Editing a menu resource script . . . . . . . . . 171
Fine-tuning the size of controls . . . . . . . . . 156 Adding a menu or separator to the menu bar .172
Moving and resizing controls at the same Adding a predefined menu . . . . . . . . . . .172
time . . . . . . . . . . . . . . . . . . . . . . . . 156 Adding a custom menu . . . . . . . . . . . . .173
Grouping and ungrouping controls . . . . . . 157 Adding a separator. . . . . . . . . . . . . . . .173
Setting the tab order of controls . . . . . . . . 157 Adding a menu item or separator to a menu .173
Aligning controls . . . . . . . . . . . . . . . . . 157 Setting the initial state of a menu or menu
item. . . . . . . . . . . . . . . . . . . . . . . . .174
Aligning controls with the Align|Align
command . . . . . . . . . . . . . . . . . . . . 158 Changing the identifier for a menu item . . . .175
Aligning controls with the Alignment Associating Help text with a menu item . . . .175
palette . . . . . . . . . . . . . . . . . . . . . . 158 Assigning an accelerator to a menu item. . . .175
Aligning controls with the grid . . . . . . . . 159 Copying, moving, or removing a menu,
Aligning controls in columns and rows . . . 159 menu item, or separator. . . . . . . . . . . . .176
Undoing actions . . . . . . . . . . . . . . . . . 160 Checking for duplicate identifiers. . . . . . . .177
Setting the Windows class of a control . . . . 160 Creating a resource script for a floating menu 177
Setting common properties using the Customizing the Menu editor. . . . . . . . . . 178
Properties window . . . . . . . . . . . . . . . 160 Editing an accelerator table resource script . . 178
Setting common properties using the Style Adding an accelerator resource . . . . . . . . .179
window . . . . . . . . . . . . . . . . . . . . . 161
Changing the identifier for an accelerator
Setting the unique properties of a control. . . 161 resource . . . . . . . . . . . . . . . . . . . . . .179
Push button properties . . . . . . . . . . . . . 162 Changing the keyboard combination for an
Type property . . . . . . . . . . . . . . . . 162 accelerator resource . . . . . . . . . . . . . . .180
Control ID property . . . . . . . . . . . . . 162 Copying, moving, or removing an
Radio button properties . . . . . . . . . . . . . 163 accelerator resource . . . . . . . . . . . . . . .180
Check box properties . . . . . . . . . . . . . . 163 Checking for duplicate keyboard
Static text properties . . . . . . . . . . . . . . . 163 combinations . . . . . . . . . . . . . . . . . . .181
Group box properties . . . . . . . . . . . . . . 164
Customizing the Accelerator editor . . . . . . 181
Scroll bar properties . . . . . . . . . . . . . . . 164
Edit box properties. . . . . . . . . . . . . . . . 164 Using menu and accelerator resources in an
Case property. . . . . . . . . . . . . . . . . 164 application . . . . . . . . . . . . . . . . . . . . 181
Windows 3.1 Style property . . . . . . . . 164 Programming menus and accelerators with
Line property . . . . . . . . . . . . . . . . . 165 OWL . . . . . . . . . . . . . . . . . . . . . . . .181
Miscellaneous Boolean properties . . . . . 165 Programming menus and accelerators with
List box properties . . . . . . . . . . . . . . . . 165 the Windows API . . . . . . . . . . . . . . . .181
Combo box properties. . . . . . . . . . . . . . 166
Type property . . . . . . . . . . . . . . . . 166 Chapter 12
Miscellaneous Boolean properties . . . . . 166 Working with string tables 183
Icon properties . . . . . . . . . . . . . . . . . . 167
Frame properties . . . . . . . . . . . . . . . . . 167
Editing a string table resource script . . . . . . 183
Rectangle properties . . . . . . . . . . . . . . . 167 Adding a string resource . . . . . . . . . . . . .183
Changing the characters of a string resource .184

iv
Changing the identifier for a string resource . 184 Changing a color on the Colors palette . . . . .200
Grouping string resources to maximize Specifying whether the Colors palette is
memory efficiency . . . . . . . . . . . . . . . 184 saved. . . . . . . . . . . . . . . . . . . . . . . .201
Copying, moving, or removing a string Specifying whether a grid appears when
resource . . . . . . . . . . . . . . . . . . . . . 185 you zoom in. . . . . . . . . . . . . . . . . . . .201
Customizing the String editor . . . . . . . . . 185 Using a graphic resource in an application . . 201
Using a string resource in an application . . . 185 Programming a bitmap with OWL . . . . . . .201
Programming an icon with OWL . . . . . . . .202
Chapter 13 Programming a cursor with OWL . . . . . . .202
Working with graphics 187 Programming a bitmap with the Windows
API . . . . . . . . . . . . . . . . . . . . . . . . .202
Editing a resource script for a graphic. . . . . 187 Programming an icon with the Windows
Choosing colors . . . . . . . . . . . . . . . . . . 189 API . . . . . . . . . . . . . . . . . . . . . . . . .203
Choosing a color that represents a Programming a cursor with the Windows
transparent or inverted area . . . . . . . . . 189 API . . . . . . . . . . . . . . . . . . . . . . . . .203
Choosing a pen style . . . . . . . . . . . . . . . 189
Choosing a brush shape . . . . . . . . . . . . . 190 Chapter 14
Choosing a paint pattern . . . . . . . . . . . . 190 Working with version information
Drawing and painting . . . . . . . . . . . . . . 190
Drawing a line. . . . . . . . . . . . . . . . . . . 191 and custom data types 205
Drawing a shape . . . . . . . . . . . . . . . . . 191 Creating a custom data type. . . . . . . . . . . 205
Filling an area with color . . . . . . . . . . . . 191 Editing a resource script for version
Adding text . . . . . . . . . . . . . . . . . . . . 192 information or a custom data type . . . . . . 206
Erasing an area . . . . . . . . . . . . . . . . . . 192 Editing a resource script for version
Selecting an area . . . . . . . . . . . . . . . . . 192 information . . . . . . . . . . . . . . . . . . . .206
Aligning an area . . . . . . . . . . . . . . . . . 193 The versionID parameter . . . . . . . . . . . .206
Moving or resizing an area . . . . . . . . . . . 193 The fixed-info parameter . . . . . . . . . . . .206
Copying or removing an area. . . . . . . . . . 193 The block-statements parameter . . . . . . . .207
Zooming in on or out from a graphic . . . . . 194 A string information block . . . . . . . . . .207
Moving a graphic around in the Drawing A variable information block . . . . . . . .207
Area. . . . . . . . . . . . . . . . . . . . . . . . 194 Constants . . . . . . . . . . . . . . . . . . . . .208
Viewing an icon or cursor in another fileflags . . . . . . . . . . . . . . . . . . . . .208
resolution . . . . . . . . . . . . . . . . . . . . 194 fileos. . . . . . . . . . . . . . . . . . . . . . .208
Testing an icon or cursor . . . . . . . . . . . . 195 filetype . . . . . . . . . . . . . . . . . . . . .208
Adding or removing an image from an icon subtype . . . . . . . . . . . . . . . . . . . . .209
or cursor . . . . . . . . . . . . . . . . . . . . . 195 langID. . . . . . . . . . . . . . . . . . . . . .209
Changing the properties of a bitmap . . . . . 196 charsetID . . . . . . . . . . . . . . . . . . . .210
Changing the properties of a cursor . . . . . . 196 string-name . . . . . . . . . . . . . . . . . .211
Changing the properties of an icon . . . . . . 197 Editing a resource script for a custom data
Changing the properties of a font . . . . . . . 197 type. . . . . . . . . . . . . . . . . . . . . . . . .211
Changing the general properties of a font . . 197 The resource-name parameter . . . . . . . . .211
Changing the height and width of the The type-ID parameter . . . . . . . . . . . . .211
characters in a font . . . . . . . . . . . . . . . 198 The load-type parameter . . . . . . . . . . . .211
Changing the ANSI codes of the characters The filename parameter . . . . . . . . . . . . .212
in a font . . . . . . . . . . . . . . . . . . . . . 198 The block-statements parameter . . . . . . . .212
Changing the number of characters in a Entering data in a resource script . . . . . . . .212
font . . . . . . . . . . . . . . . . . . . . . . . . 199 Compiling a resource script . . . . . . . . . . . 212
Editing a specific character in a font . . . . . . 199 Using a version information resource in an
Customizing the Graphic editor . . . . . . . . 199 application . . . . . . . . . . . . . . . . . . . . 213
Adding or removing a second pane from the Using a resource for a custom data type in
Edit window. . . . . . . . . . . . . . . . . . . 199 an application. . . . . . . . . . . . . . . . . . .213
Hiding or showing the Tools and Colors
palettes . . . . . . . . . . . . . . . . . . . . . . 200

v
Appendix A Appendix C
Using EasyWin 215 Error messages 221
_InitEasyWin( ) . . . . . . . . . . . . . . . . . . 215 Message classes . . . . . . . . . . . . . . . . . . 221
Added functions . . . . . . . . . . . . . . . . . 216 Fatal errors . . . . . . . . . . . . . . . . . . . . .221
Errors . . . . . . . . . . . . . . . . . . . . . . . .222
Appendix B Warnings . . . . . . . . . . . . . . . . . . . . . .222
Precompiled headers 217 Help compiler messages . . . . . . . . . . . . . 222
How they work . . . . . . . . . . . . . . . . . . 217 Message listings . . . . . . . . . . . . . . . . . . 223
Drawbacks. . . . . . . . . . . . . . . . . . . . . 218 Message explanations . . . . . . . . . . . . . . 223
Using precompiled headers. . . . . . . . . . . 218
Setting file names . . . . . . . . . . . . . . . . . 218 Index 273
Establishing identity . . . . . . . . . . . . . . . 218
Optimizing precompiled headers . . . . . . . 219

vi
Tables Figures
1.1 The IDE menus . . . . . . . . . . . . . . . . . . .8 1.1 The Turbo C++ IDE . . . . . . . . . . . . . . . . 8
3.1 Default Project Option settings . . . . . . . . . 58 1.2 The New Target dialog box . . . . . . . . . . .11
4.1 Sample application files . . . . . . . . . . . . . 64 1.3 The Environment Options dialog box . . . . .14
6.1 Filter letters in the browser . . . . . . . . . . . 87 2.1 The Project window displaying a
6.2 Browser search expressions . . . . . . . . . . . 88 Project Tree . . . . . . . . . . . . . . . . . . . . .20
7.1 Expression format specifiers . . . . . . . . . 104 2.2 TargetExpert dialog box . . . . . . . . . . . . .22
7.2 CPU flags in the Register window . . . . . . 106 2.3 The Environment Options dialog box . . . . .28
8.1 Mouse messages . . . . . . . . . . . . . . . . .117 2.4 The Tools dialog box . . . . . . . . . . . . . . .31
8.2 Window messages . . . . . . . . . . . . . . . .117 2.5 The Tool Advanced Options dialog box. . . .33
8.3 Input messages . . . . . . . . . . . . . . . . . .117 3.1 The Project Options dialog box . . . . . . . . .36
8.4 System messages . . . . . . . . . . . . . . . . .117 3.2 Style Sheets dialog box . . . . . . . . . . . . . .37
8.5 Pen messages . . . . . . . . . . . . . . . . . . .118 3.3 The Options Hierarchy dialog box . . . . . . .40
8.6 Initialization messages . . . . . . . . . . . . . .118 4.1 AppExpert Application Generation
8.7 Clipboard messages . . . . . . . . . . . . . . .118 Options dialog box . . . . . . . . . . . . . . . .63
8.8 DDE messages. . . . . . . . . . . . . . . . . . .118 4.2 DRAW.IDE loaded into the Project
8.9 Nonclient messages . . . . . . . . . . . . . . .118 Manager. . . . . . . . . . . . . . . . . . . . . . .65
8.10 Control messages . . . . . . . . . . . . . . . . .118 5.1 ClassExpert . . . . . . . . . . . . . . . . . . . . .75
8.11 Multimedia messages . . . . . . . . . . . . . 120 5.2 Add New Class dialog box. . . . . . . . . . . .77
8.12 Other messages and messages not 6.1 Viewing classes in an application . . . . . . . .86
documented by Microsoft . . . . . . . . . . . 120 6.2 Symbol declaration window. . . . . . . . . . .87
8.13 Exception types . . . . . . . . . . . . . . . . . 122 7.1 The Breakpoints window. . . . . . . . . . . . .97
8.14 DFA options . . . . . . . . . . . . . . . . . . . 128 7.2 The Breakpoint Properties dialog box . . . . .98
7.3 The Watch window . . . . . . . . . . . . . . . 101
7.4 The Watch Properties dialog box . . . . . . . 102
7.5 The Expression Evaluator dialog box . . . . 103
7.6 Inspect windows. . . . . . . . . . . . . . . . . 106
7.7 Call Stack window. . . . . . . . . . . . . . . . 107

xii

Das könnte Ihnen auch gefallen