Delphi Programming Guide
Delphi Programmer 

Menu  Table of contents
Bookmark and Share

Part I - Foundations
  Chapter 1 Delphi 7 and Its IDE
  Chapter 2 The Delphi Programming Language
  Chapter 3 The Run-Time Library
  Chapter 4 Core Library classes
  Chapter 5 Visual Controls
  Chapter 6 Building the User Interface
  Chapter 7 Working with Forms
Part II - Delphi Object-Oriented Architectures
  Chapter 8 The Architecture of Delphi Applications
  Chapter 9 Writing Delphi Components
  Chapter 10 Libraries and Packages
  Chapter 11 Modeling and OOP Programming (with ModelMaker)
  Chapter 12 From COM to COM+
Part III - Delphi Database-Oriented Architectures
  Chapter 13 Delphi's Database Architecture
  Chapter 14 Client/Server with dbExpress
  Chapter 15 Working with ADO
  Chapter 16 Multitier DataSnap Applications
  Chapter 17 Writing Database Components
  Chapter 18 Reporting with Rave
Part IV - Delphi, the Internet, and a .NET Preview
  Chapter 19 Internet Programming: Sockets and Indy
  Chapter 20 Web Programming with WebBroker and WebSnap
  Chapter 21 Web Programming with IntraWeb
  Chapter 22 Using XML Technologies
  Chapter 23 Web Services and SOAP
  Chapter 24 The Microsoft .NET Architecture from the Delphi Perspective
  Chapter 25 Delphi for .NET Preview: The Language and the RTL
       
  Appendix A Extra Delphi Tools by the Author
  Appendix B Extra Delphi Tools from Other Sources
  Appendix C Free Companion Books on Delphi
       
  Index    
  List of Figures    
  List of tables    
  List of Listings    
  List of Sidebars  

 
Previous Section Next Section

The Files Produced by the System

Delphi produces various files for each project, and you should know what they are and how they are named. Basically, two elements have an impact on how files are named: the names you give to a project and its units, and the predefined file extensions used by Delphi. Table 1.1 lists the extensions of the files you'll find in the directory where a Delphi project resides. The table also shows when or under what circumstances these files are created and their importance for future compilations.

Table 1.1: Delphi Project File Extensions

Extension

File Type and Description

Creation Time

Required to Compile?

.BMP, .ICO, .CUR

Bitmap, icon, and cursor files: standard Windows files used to store bitmapped images.

Development: Image Editor

Usually not, but they might be needed at run time and for further editing.

.BPG

Borland Project Group: the files used by the new multiple-target Project Manager. It is a sort of makefile.

Development

Required to recompile all the projects of the group at once.

.BPL

Borland Package Library: a DLL including VCL components to be used by the Delphi environment at design time or by applications at run time. (These files used a .DPL extension in Delphi 3.)

Compilation: Linking

You'll distribute packages to other Delphi developers and, optionally, to endusers.

.CAB

The Microsoft Cabinet compressed-file format used for web deployment by Delphi. A CAB file can store multiple compressed files.

Compilation

Distributed to users.

.CFG

Configuration file with project options. Similar to the DOF files.

Development

Required only if special compiler options have been set.

.DCP

Delphi Compiled Package: a file with symbol information for the code that was compiled into the package. It doesn't include compiled code, which is stored in DCU files or in the BPL file.

Compilation

Required when you use run-timepackages. You'll distribute it only to other developers along with BPL files. You can compile an application with the units from a package just by having theDCP file and the BPL (and no DCU files).

.DCU

Delphi Compiled Unit: the result of the compilation of a Pascal file.

Compilation

Only if the source code is not available. DCU files for the units you write are an intermediate step, so they make compilation faster.

.DDP

The Delphi Diagram Portfolio, used by the Diagram view of the editor (was .DTI in Delphi 5)

Development

No. This file stores "design-time only" information, not required by the resulting program but very important for the programmer.

.DFM

Delphi Form File: a binary file with the description of the properties of a form (or a data module) and of the components it contains.

Development

Yes. Every form is stored in both a PAS and a DFM file.

.~DF

Backup of Delphi Form File (DFM).

Development

No. This file is produced when you save a new version of the unit related to the form and the form file along with it.

.DFN

Support file for the Integrated Translation Environment (there is one DFN file for each form and each target language).

Development (ITE)

Yes (for ITE). These files contain the translated strings that you edit in the Translation Manager.

.DLL

Dynamic link library: another version of an executable file.

Compilation: Linking

See .EXE.

.DOF

Delphi Option File: a text file with the current settings for the project options.

Development

Required only if special compiler options have been set.

.DPK and now also .DPKW and .DPKL

Delphi Package: the project source code file of a package (ora specific project file for Windows or Linux).

Development

Yes.

.DPR

Delphi Project file. (This file actually contains Pascal sourcecode.)

Development

Yes.

.~DP

Backup of the Delphi Project file(.DPR).

Development

No. This file is generated auto-matically when you save a new version of a project file.

.DSK

Desktop file: contains infor-mation about the position of the Delphi windows, the files open in the editor, and other Desktop settings.

Development

No. You should actually delete it if you copy the project to a new directory.

.DSM

Delphi Symbol Module: stores all the browser symbol information.

Compilation (but only if the Save Symbols option is set)

No. Object Browser uses this file, instead of the data in memory, when you cannot recompile a project.

.EXE

Executable file: the Windows application you've produced.

Compilation: Linking

No. This is the file you'll distribute. It includes all of the compiled units, forms, and resources.

.HTM

Or .HTML, for Hypertext Markup Language: the file format used forInternet web pages.

Web deployment of an ActiveForm

No. This is not involved in the project compilation.

.LIC

The license files related to an OCX file.

ActiveX Wizard and other tools

No. It is required to use the control in another development environment.

.OBJ

Object (compiled) file, typical of the C/C++ world.

Intermediate compilation step, generally not used in Delphi

It might be required to merge Delphi with C++ compiled code ina single project.

OCX

OLE Control Extension: a special version of a DLL, containing ActiveX controls or forms.

Compilation: Linking

See .EXE.

.PAS

Pascal file: the source code of aPascal unit, either a unit related to a form or a stand-alone unit.

Development

Yes.

.~PA

Backup of the Pascal file (.PAS).

Development

No. This file is generated automatically by Delphi when you save a new version of the source code.

.RES, .RC

Resource file: the binary file associated with the project and usually containing its icon. You can add other files of this type to a project. When you create custom resource files you might use also the textual format, .RC.

Development Options dialog box. The ITE (Integrated Translation Environment) gene-rates resource files with special comments.

Yes. The main RES file of an application is rebuilt by Delphi according to the information in the Application page of the Project Options dialog box.

.RPS

Translation Repository (part of the Integrated Translation Environment).

Development (ITE)

No. Required to manage the translations.

.TLB

Type Library: a file built automatically or by the Type Library Editor for OLE server applications.

Development

This is a file other OLE programs might need.

TODO

To-do list file, holding the items related to the entire project.

Development

No. This file hosts notes for the programmers.

.UDL

Microsoft Data Link.

Development

Used by ADO to refer to a data provider. Similar to an alias in the BDE world (see Chapter 12).

Besides the files generated during the development of a project in Delphi, many others are generated and used by the IDE itself. In Table 1.2, I've provided a short list of extensions worth knowing about. Most of these files are in proprietary and undocumented formats, so there is little you can do with them.

Table 1.2: Selected Delphi IDE Customization File Extensions

Extension

File Type

.DCI

Delphi code templates.

.DRO

Delphi's Object Repository. (The repository should be modified with the Tools ® Repository command.)

.DMT

Delphi menu templates.

.DBI

Database Explorer information.

.DEM

Delphi edit mask (files with country-specific formats for edit masks).

.DCT

Delphi component templates.

.DST

Desktop settings file (one for each desktop setting you've defined).

Looking at Source Code Files

I've just listed some files related to the development of a Delphi application, but I want to spend a little time covering their actual format. The fundamental Delphi files are Pascal source code files, which are plain ASCII text files. The bold, italic, and colored text you see in the editor depends on syntax highlighting, but it isn't saved with the file. It is worth noting that there is a single file for the form's whole code, not just small code fragments.

Tip 

In the listings in this book, I've matched the bold syntax highlighting of the editor for keywords and the italic for strings and comments.

For a form, the Pascal file contains the form class declaration and the source code of the event handlers. The values of the properties you set in the Object Inspector are stored in a separate form description file (with a .DFM extension). The only exception is the Name property, which is used in the form declaration to refer to the components of the form.

The DFM file is by default a text representation of the form, but it can also be saved in a binary Windows Resource format. You can set the format you want to use for new projects in the Designer page of the Environment Options dialog box, and you can toggle the format of individual forms with the Text DFM command on a form's shortcut menu. A plain-text editor can read only the text version. However, you can load DFM files of both types in the Delphi editor, which will, if necessary, first convert them into a textual description. The simplest way to open the textual description of a form (whatever the format) is to select the View As Text command on the shortcut menu in the Form Designer. This command closes the form, saving it if necessary, and opens the DFM file in the editor. You can later go back to the form using the View As Form command on the shortcut menu in the editor window.

You can edit the textual description of a form, although you should do so with extreme care. As soon as you save the file, it will be parsed to regenerate the form. If you've made incorrect changes, compilation will stop with an error message; you'll need to correct the contents of your DFM file before you can reopen the form. For this reason, you shouldn't try to change the textual description of a form manually until you have good knowledge of Delphi programming.

Tip 

In the book, I often show you excerpts of DFM files. In most of these excerpts, I show only the relevant components or properties; generally, I have removed the positional properties, the binary values, and other lines providing little useful information.

In addition to the two files describing the form (PAS and DFM), a third file is vital for rebuilding the application: the Delphi project file (DPR), which is another Pascal source code file. This file is built automatically, and you seldom need to change it manually. You can see this file with the Project ® View Source menu command.

Some of the other, less relevant files produced by the IDE use the structure of Windows INI files, in which each section is indicated by a name enclosed in square brackets. For example, this is a fragment of an option file (DOF):

[Compiler]
A=1
B=0
ShowHints=1
ShowWarnings=1
   
[Linker]
MinStackSize=16384
MaxStackSize=1048576
ImageBase=4194304
   
[Parameters]
RunParams=
HostApplication=

The same structure is used by the Desktop files (DSK), which store the status of the Delphi IDE for the specific project, listing the position of each window. Here is a small excerpt:

[MainWindow]
Create=1
Visible=1
State=0
Left=2
Top=0
Width=800
Height=97

 
Previous Section Next Section


 


 


Copyright © 2004-2019 "Delphi Sources". Delphi Programming Guide
   Facebook     Twitter