connect.pas

来自「冰河反弹版之独孤夕客专版 今天我决定把这个版本的冰河反弹版程序源码公布」· PAS 代码 · 共 53 行

PAS
53
字号
unit Connect;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, Buttons, IdStack, IdBaseComponent, IdComponent,
  IdTCPConnection, IdTCPClient, IdTCPServer;

type
  TConnectForm = class(TForm)
    lblAddress: TLabel;
    bitbtnOk: TBitBtn;
    bitbtnNo: TBitBtn;
    TCPClient: TIdTCPClient;
    edtIPAddress: TEdit;
    procedure bitbtnOkClick(Sender: TObject);
    procedure bitbtnNoClick(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  ConnectForm: TConnectForm;

implementation

{$R *.dfm}

procedure TConnectForm.bitbtnOkClick(Sender: TObject);
begin
  if edtIPAddress.Text <> '' then
  begin
    TCPClient.Host := edtIPAddress.Text;
    try
      if not TCPClient.Connected then
        TCPClient.Connect;
    except
      ShowMessage('连接错误!');
    end;
  end;
  Close;
end;

procedure TConnectForm.bitbtnNoClick(Sender: TObject);
begin
  Close;
end;

end.

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?