// 下面是工程单元
program Project1;
uses
Forms,
Unit1 in 'Unit1.pas' {frmMain},
Unit2 in 'Unit2.pas' {frmEdit};
{$R *.res}
begin
Application.Initialize;
Application.CreateForm(TfrmMain, frmMain);
// Application.CreateForm(TfrmEdit, frmEdit); <--工程里注销这个你要FORM
Application.Run;
end.
//下载是主窗口单元
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TfrmMain = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
frmMain: TfrmMain;
implementation
uses Unit2;
{$R *.dfm}
procedure TfrmMain.Button1Click(Sender: TObject);
var
frmEdit:TfrmEdit;
begin
frmEdit:=TfrmEdit.Create(Self);
frmEdit.Show;
end;
end.
//下载是你要调用的窗口
unit Unit2;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TfrmEdit = class(TForm)
Edit1: TEdit;
procedure FormClose(Sender: TObject; var Action: TCloseAction);
private
{ Private declarations }
public
{ Public declarations }
end;
var
frmEdit: TfrmEdit;
implementation
{$R *.dfm}
procedure TfrmEdit.FormClose(Sender: TObject; var Action: TCloseAction);
begin
Self.Free;
end;
end.