November, 1995 - Vol. 2 No. 11
If you've used the Borland C++ AppExpert to automatically generate an ObjectWindows Library (OWL) application, you know how simple it can be to use the AppExpert dialog box to specify your application's characteristics, as shown in Figure A. However, if you use AppExpert very often, you'll find yourself setting several options to the same values for each new project.
Figure A - You use the AppExpert Application Generation Options dialog box to specify the characteristics of an AppExpert application.
You may not realize it, but you can specify the default values
that AppExpert uses for many of its configuration options. In
this article, we'll document some of the most useful option
changes, and we'll show how you can apply them by creating
EXPERT.INI, the initialization file for AppExpert.
You can preset several of AppExpert's default options by creating a simple initialization text file named EXPERT.INI. Since some of the AppExpert settings can be rather obscure, we'll focus on some of the more important options you can adjust from the INI file. (By the way, you can set all of the AppExpert default values or just a few. AppExpert will use its internal defaults for any setting you don't override.)
The most obvious AppExpert settings you can adjust pertain to the application itself. To adjust these options, you'll add the appropriate INI entries and values in a section of the EXPERT.INI file that's titled [Application]. Table A summarizes the [Application] section settings.
Table A: [Application] section settings
Option | Setting | Meaning |
Window Model | Model=1 | MDI (Multiple Document Interface) |
Model=2 | SDI (Single Document Interface) | |
Model=3 | Dialog Client | |
Document/View | DocView=0 | Off |
DocView=1 | On | |
Toolbar | SpeedBar=0 | Off |
SpeedBar=1 | On | |
Status Line | StatusBar=0 | Off |
SpeedBar=1 | On | |
Drag/Drop | DragDrop=0 | Off |
DragDrop=1 | On | |
Printing | Printing=0 | Off |
Printing=1 | On | |
Application Startup State | Startup=1 | Maximized |
Startup=2 | Minimized | |
Startup=3 | Normal | |
Control Style | Control=0 | MS Control 3D |
Control=1 | Standard Windows | |
Control=2 | Borland BWCCz |
The next most useful INI section you can modify pertains to the text that appears on the Administrative Options page (a subtopic of the Application topic) of the AppExpert Application Generation Options dialog box. (This is the text that AppExpert will insert into a comment at the beginning of each of the project's files.) To adjust these options, you'll add the appropriate INI entries and values in a section that's titled [Annotation]. Table B displays sample [Annotation] section settings.
Table B: [Annotation] section settings
Option | Setting |
Version Number | Version=3.5 |
Copyright | Copyright=Copyright 1995 TySoft |
Description | Description=Playtime App |
Author | Author=George Baggs |
Company | Company=TySoft Systems, Inc. |
The final INI file section we'll examine is the [CGenOptions] section. In this section, you can adjust how AppExpert generates code and whether it will display a detailed error file when you run AppExpert or Rescan (an AppExpert maintenance tool). Table C summarizes the [CGenOptions] section settings. (Note: You can't adjust these settings from the AppExpert Application Generation Options dialog box.)
Table C: [CGenOptions] section settings
Option | Setting | Meaning |
Exception- Handling | Exception=FALSE Exception=TRUE |
Off On |
Generate Make File | MAK=0 MAK=1 |
Off On |
Dump AppExpert error messages to a file | Dump=0 Dump=1 |
Off On |
These three INI file sections cover most of AppExpert's
features and options. Now let's create a simple example
that shows how easily you can change the AppExpert default settings
for the author's name and other annotation settings.
Begin by launching Borland C++ version 4.0 or higher. When the Integrated Development Environment (IDE) main window appears, choose Open from the File menu, enter \WINDOWS\EXPERT.INI in the File Name entry field, and click OK.
When the new editing window appears, enter the following information:
[Annotation] Author=Mr. Math Company=New Additions Version=3.1415926 Description=Pi Chart App
You'll notice that you're not entering a value for the Copyright setting. As we mentioned earlier, if you don't specify a new setting for one of the AppExpert defaults, AppExpert will supply its own.
When you've finished entering the new [Annotation] section, choose Save from the File menu. Then, choose AppExpert from the Project menu.
When the New AppExpert Project dialog box appears, enter the name \TEST\XPRT.IDE in the File Name entry field and click OK. When the AppExpert Application Generation Options dialog box appears, click the plus (+) icon next to the Application topic, and then select the sub-topic Admin Options. On the Administrative Options page of this dialog box, you'll see the new default values, as shown in Figure B.
Figure B - You can use the EXPERT.INI file to preset various AppExpert default values.
You'll notice that the Copyright entry field contains the
standard default text string that normally appears, since you
didn't change its value in the EXPERT.INI file. Similarly,
you'll notice that the order of our new settings in the
EXPERT.INI file didn't make any difference. (That's
standard INI file behavior.)
AppExpert can streamline much of your C++ Windows development
cycle. By using the technique we've shown here to customize
the AppExpert defaults, you can save time you'd normally
spend modifying basic settings.
Copyright (c) 1996 The Cobb Group, a division of Ziff-Davis Publishing Company. All rights reserved. Reproduction in whole or in part in any form or medium without express written permission of Ziff-Davis Publishing Company is prohibited. The Cobb Group and The Cobb Group logo are trademarks of Ziff-Davis Publishing Company.