扫一扫
分享文章到微信
扫一扫
关注官方公众号
至顶头条
写自己的dpk工程,以更改地检测我们的猜想。我们首先建立一个project group,包含三个工程:
program ProjectEXE;
uses
Forms,
Windows,
UnitFormMain in 'UnitFormMain.pas' {FormMain};
{$R *.res}
begin
Application.Initialize;
Application.CreateForm(TFormMain, FormMain);
Application.Run;
end.
unit UnitFormMain;
interface
uses
Windows, StdCtrls, Forms, Classes, Controls;
type
TFormMain = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
FormMain: TFormMain;
implementation
{$R *.dfm}
procedure TFormMain.Button1Click(Sender: TObject);
var
LForm:TForm2;
begin
LForm:=TForm2.Create(Application);
LForm.ShowModal;
LForm.Free;
end;
end.
package Package1;
requires
vcl,
rtl;
contains
UnitFormAnother in 'UnitFormAnother.pas' {FormAnother},
UnitForm1 in 'UnitForm1.pas' {Form1};
end.
unit UnitFormAnother;
interface
uses
Forms;
type
TFormAnother = class(TForm)
private
{ Private declarations }
public
{ Public declarations }
end;
implementation
{$R *.dfm}
end.
unit UnitForm1;
interface
uses
UnitFormAnother;
type
TForm1 = class(TFormAnother)
private
{ Private declarations }
public
{ Public declarations }
end;
implementation
{$R *.dfm}
end.
package Package2;
requires
rtl,
vcl;
contains
UnitForm2 in 'UnitForm2.pas' {Form2};
end.
unit UnitForm2;
interface
uses
UnitFormAnother;
type
TForm2 = class(TFormAnother)
private
{ Private declarations }
public
{ Public declarations }
end;
implementation
{$R *.dfm}
end.
小技巧:delphi对project group的编译是按照列表顺序从上到下进行的,因此在有些时候,被require或者use的文件如果在下面,那么可能会提示找不到文件。因此最好用文本编辑器调整一下bpg文件中的列表顺序。
如果您非常迫切的想了解IT领域最新产品与技术信息,那么订阅至顶网技术邮件将是您的最佳途径之一。
现场直击|2021世界人工智能大会
直击5G创新地带,就在2021MWC上海
5G已至 转型当时——服务提供商如何把握转型的绝佳时机
寻找自己的Flag
华为开发者大会2020(Cloud)- 科技行者