还是不行啊,请看一下程序有什么问题或者贴一个可用的代码让我比较一下吧,代码如下
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, IdBaseComponent, IdComponent, IdTCPServer, StdCtrls,
IdAntiFreezeBase, IdAntiFreeze;
type
TForm1 = class(TForm)
IdTCPServer1: TIdTCPServer;
Button1: TButton;
procedure IdTCPServer1Execute(AThread: TIdPeerThread);
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
uses Unit2;
{$R *.dfm}
procedure TForm1.IdTCPServer1Execute(AThread: TIdPeerThread);
begin
button1.Caption:=AThread.Connection.ReadLn();
AThread.Connection.Disconnect;
form2.Show;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
Form2.Show;
end;
end.
-------------------------------
unit Unit2;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, IdBaseComponent, IdAntiFreezeBase, IdAntiFreeze;
type
TForm2 = class(TForm)
Edit1: TEdit;
Button1: TButton;
procedure FormShow(Sender: TObject);
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form2: TForm2;
implementation
uses Unit1;
{$R *.dfm}
procedure TForm2.FormShow(Sender: TObject);
begin
//edit1.Text:=Form1.Button1.Caption;
end;
procedure TForm2.Button1Click(Sender: TObject);
begin
//Form2.Visible:=False;
end;
end.