Borland Online And The Cobb Group Present:


October, 1995 - Vol. 2 No. 10

Opening a default project

In versions of Borland C++ prior to version 4.0, the Integrated Development Environment (IDE) would store the path and filename of the current project file when you quit the IDE. The next time you launched the IDE, it would reopen that project. However, beginning with version 4.0, the Borland C++ IDE no longer opens a default project.

Despite this limitation, you can configure Borland C++ 4.x to load a specific project file at startup. In this article, we'll show you how to do so.

Command-line performance

As you may know, you can launch the Bor-land C++ IDE using one of four methods:

The first two methods launch the IDE in the standard manner, with no current project. The second two, however, launch the IDE with a specific project by passing the appropriate project filename as a command-line parameter to BCW.EXE.

(By the way, if you're not familiar with the way Windows 3.1 uses the Registration Database to enable associations between applications such as BCW.EXE and specific file types such as *.IDE, it's fairly simple. The Registration Database contains a list of one or more file extensions that "belong" to a specific executable's path and filename. When you double-click an IDE file in File Manager, the Registration Database locates the corresponding executable and then launches the executable with the IDE filename as a command-line parameter. See Under the hood of Windows 3.1 - Examining the Windows Registration Database for more information.)

One obvious way to launch a specific project from Program Manager is to modify the properties of a copy of the Borland C++ program item to include the appropriate project file in the icon's command line. Unfortunately, this method hard-codes the path to the executable inside the icon's settings. If you upgrade to a newer version of Borland C++ and eliminate the current BCW.EXE path, you'll have to go back and update the command line for each project's icon.

Instead, you can create Program Manager icons for individual project files. By doing so, you'll take advantage of the fact that the Borland C++ installation program updates the Windows Registration Database when you upgrade the compiler. Even if the path to the BCW.EXE file changes, Program Manager will still launch the IDE, since double-clicking a data file's icon in Program Manager achieves the same result as double-clicking the icon in File Manager.

If you're using Windows 95, this technique becomes even more valuable. That's because Windows 95's Explorer interface (which performs File Manager functions) will update the Registration Database if you merely move the BCW.EXE executable by using Explorer. (Obviously, if you wanted to continue using BCW.EXE, you'd need to move the appropriate DLLs as well.)

To create Program Manager icons for individual project files, you'll use File Manager's drag-and-drop capabilities to drop an IDE file into a Program Manager program group. Now let's create a Program Manager project-file item.

Project (File) manager

To begin, make sure the Borland C++ program group is visible in Program Manager. Then, launch File Manager and locate the WHELLO.IDE file in the \BC45\BIN\EXAMPLES\WINDOWS\WHELLO directory.

Now, click the file's icon, drag the icon outside the File Manager window, and drop it in the Borland C++ program group. After you release the mouse button, choose Exit from the File menu to quit File Manager.

Next, double-click the new Whello program item. It will automatically display the Borland C++ IDE's icon, as shown in Figure A.

Figure A - When you create a program item for a project, it displays the Borland C++ IDE icon.

When the IDE's main window appears, display the project window, if necessary, to confirm that the IDE loaded the WHELLO.IDE project. Choose Exit from the File menu to quit the IDE.

Conclusion

Recent versions of Borland C++ don't automatically reopen the last open project file. However, you can take advantage of several other launching options, such as creating program items for project files as we've shown here, to gain instant access to the file of your choice.

Return to the Borland C++ Developer's Journal index

Subscribe to the Borland C++ Developer's Journal


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.