Originale-mail to me for new edition

 

Other files used to build applications

 

In addition to source-code modules, Borland products use several non-Pascal files to build applications. These files are maintained automatically and include

·form files, which end with the .dfm (Delphi) or .xfm (Kylix) extension,

·resource files, which end with the .res extension,

·project options files, which end with the .dof (Delphi) or .kof (Kylix) extension.

A form file is either a text file or a compiled resource file that can contain bitmaps, strings, and so forth. Each form file represents a single form, which usually corresponds to a window or dialog box in an application. The IDE allows you to view and edit form files as text, and to save form files as either text or binary. Although the default behavior is to save form files as text, they are usually not edited manually; it is more common to use Borland’s visual design tools for this purpose. Each project has at least one form, and each form has an associated unit (.pas) file that, by default, has the same name as the form file.

In addition to form files, each project uses a resource (.res) file to hold the bitmap for the application’s icon. By default, this file has the same name as the project (.dpr) file. To change an application’s icon, use the Project Options dialog.

A project options (.dof or .kof) file contains compiler and linker settings, search directories, version information, and so forth. Each project has an associated project options file with the same name as the project (.dpr) file. Usually, the options in this file are set from Project Options dialog.

Various tools in the IDE store data in files of other types. Desktop settings (.dsk or .desk) files contain information about the arrangement of windows and other configuration options; desktop settings can be project-specific or environment-wide. These files have no direct effect on compilation.

 

Topic groups

Using Object Pascal

Program organization: Overview

Pascal source files

Other files used to build applications

Compiler-generated files

About example programs

A simple console application

A more complicated example

A native application

 

See also

Compiler-generated files

Pascal source files

 

 

译文

 

用于建立应用程序的其他文件

 

除源代码模块外,Borland产品还使用一些非Pascal文件建立应用程序,这些文件会被自动保存,包括:

·  窗体文件,扩展文件名为.dfmDelphi.xfmKylix

·  资源文件,扩展文件名为.res

·  工程选项文件,扩展文件名为.dofDelphi)或.kofKylix

窗体文件可以是本文件,也可以是编译过的资源文件,文件中可以含有位图、字符串等。每个窗体文件代表一个单独的窗体。在应用程序中,这些窗体相当于窗口或对话框。集成开发环境允许开发者以文本的方式查看和编辑窗体文件,并以文本文件或二进制文件的形式保存。每个工程至少有一个窗体,并且每个窗体都有一个.pas单元文件与之相关联,默认情况下窗体文件与其相应的.pas文件具有相同的主文件名。

除了窗体文件之外,DelphiKylix会对每个工程用一个.res资源文件保存应用程序的图标。默认情况下该文件与其相应的.dpr文件具有相同的主文件名。要改变应用程序图标,可以使用“Project Options”对话框。

工程选项(.dof.kof)文件中含有编译器和连接设置、搜索目录、版本信息等。对于每一个工程,都有一个与之相关的工程选项文件,工程选项文件与相应工程(.dpr)文件具有相同的主文件名。工程选项文件的设置通常在“Project Options”对话框中进行。

集成开发环境中不同的工具存储数据在不同类型的文件中。桌面设置(.dsk.desk)文件中含有窗口排列位置信息和其他配置选项;桌面设置可以针对指定的工程,也可以针对较广的开发环境。这些文件对编译程序没有任何直接影响。

 

主题组

使用Object Pascal

程序组织:概述

Pascal源文件

用于建立应用程序的其他文件

编译器产生的文件

关于范例程序

简单的控制台应用程序

相对复杂的范例

本地应用程序范例

 

相关主题

编译器产生的文件

Pascal源文件

 

 

编者注

DelphiKylix自动为工程创建相应的.res资源文件,其初衷是存放应用程序图标。可以通过“Project Options”对话框对图标进行更改。但这样使得一个应用程序只能有一个图标。Borland开发工具中提供了Image Editor,可以编辑此类.res资源文件,因此可以为一个应用程序添加多个图标。需要特别指出的是,.res作为资源文件,并不是只能用于存放图标。如果需要,可以制作若干.res文件用来存放声音、视频、文档等各种类型的二进制文件(当然也可以存放文本文件),然后在单元中给出相应的编译指示,这样就可以实现在应用程序中包含各种资源。