⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sp_smg_set.~pas

📁 SPIG1.1.rar SPIG接口协议
💻 ~PAS
字号:
unit SP_SMG_Set;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, Buttons, ExtCtrls, Spin, Grids;

type
  TfrmSP_SMG_Set = class(TForm)
    GroupBox1: TGroupBox;
    TLocatIPAddr: TLabeledEdit;
    TLocatPort: TLabeledEdit;
    TUserName: TLabeledEdit;
    TPassWord: TLabeledEdit;
    TRemoteIPAddr: TLabeledEdit;
    TRemotePort: TLabeledEdit;
    TSPNumber: TLabeledEdit;
    TSPSrcNode: TLabeledEdit;
    BitBtn1: TBitBtn;
    BitBtn2: TBitBtn;
    GroupBox2: TGroupBox;
    GroupBox3: TGroupBox;
    chkLog: TCheckBox;
    Label1: TLabel;
    Label2: TLabel;
    spSendTimeOut: TSpinEdit;
    spRecvTimeOut: TSpinEdit;
    spTimeCycle: TSpinEdit;
    Label10: TLabel;
    cSecurity: TCheckBox;
    cWarning: TCheckBox;
    cReSend: TCheckBox;
    sSendTry: TSpinEdit;
    Label9: TLabel;
    chkAutoStar: TCheckBox;
    TSPCode: TLabeledEdit;
    lRecvHostPort: TLabeledEdit;
    procedure FormShow(Sender: TObject);
    procedure BitBtn1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  frmSP_SMG_Set: TfrmSP_SMG_Set;

implementation

{$R *.dfm}

uses
 SP_SMG_DLL,
 DLL_Exports,
 SPServer ;

procedure TfrmSP_SMG_Set.FormShow(Sender: TObject);
begin
try
  TLocatIPAddr.Text := GetLocatIPAddr;
  TLocatPort.Text   := IntToStr(GetLocatHostPort);
  TUserName.Text    := GetUserName;
  TPassWord.Text    := GetPassWord;
  TRemoteIPAddr.Text:= GetRemoteIPAddr;
  TRemotePort.Text  := IntToStr(GetRemoteHostPort);
  lRecvHostPort.Text:= IntToStr(GetRecvHostPort);
  TSPNumber.Text    := GetSPNumber;
  TSPSrcNode.Text   := GetSrcNode;
  TSPCode.Text      := GetSPCode;
  spSendTimeOut.Value:= GetSendTimeOut;
  spRecvTimeOut.Value:= GetRecvTimeOut;
  chkLog.Checked     := GetCurLogChk;
  cSecurity.Checked  := GetSeurity;
//  cWarning.Checked   := GetWarning;
  cReSend.Checked    := GetReSend;
  sSendTry.Value     := GetSendTry;  
  spTimeCycle.Value  := GetTimeCycle;
 except
  on exception do
   raise exception.Create('某些参数未设定!');
 end;
end;

procedure TfrmSP_SMG_Set.BitBtn1Click(Sender: TObject);
var
 I:Integer;
begin
 ModalResult := mrNone;
  if CheckIP(TLocatIPAddr.Text) <> 0 then
   begin
     ErrorMsg(1,'无效的IP地址!');
     TLocatIPAddr.SetFocus;
     Exit;
   end;
  if CheckIP(TRemoteIPAddr.Text) <> 0 then
   begin
     ErrorMsg(1,'无效的IP地址!');
     TRemoteIPAddr.SetFocus;
     Exit;
   end;

   try
    I:=StrToInt(TLocatPort.Text);
   except
    ErrorMsg(1,'无效的端口号!');
    TLocatPort.SetFocus;
    Exit;
   end;
  if (i<0) or (i>65535)
    then begin
      ErrorMsg(1,'无效的端口号!');
      TLocatPort.SetFocus;
      Exit;
    end;
  try
   I := StrToInt(TRemotePort.Text);
  except
   ErrorMsg(1,'无效的端口号!');
   TRemotePort.SetFocus;
   Exit;
  end;
  if (i<0) or (i>65535)
    then begin
      ErrorMsg(1,'无效的端口号!');
      TRemotePort.SetFocus;
      Exit;
    end;
   try
    I:=StrToInt(lRecvHostPort.Text);
   except
    ErrorMsg(1,'无效的端口号!');
    lRecvHostPort.SetFocus;
    Exit;
   end;
  if (i<0) or (i>65535)
    then begin
      ErrorMsg(1,'无效的端口号!');
      lRecvHostPort.SetFocus;
      Exit;
    end;
 SetLocatIPAddr(TLocatIPAddr.Text);
 SetLocatHostPort(StrToInt(TLocatPort.Text));
 SetUserName(TUserName.Text);
 SetPassWord(TPassWord.Text);
 SetRemoteIPAddr(TRemoteIPAddr.Text);
 SetRemoteHostPort(StrToInt(TRemotePort.Text));
 SetRecvHostPort(StrToInt(lRecvHostPort.Text));
 SetSPNumber(TSPNumber.Text);
 SetSrcNode(TSPSrcNode.Text);
 SetSPCode(TSPCode.Text);
 SetSendTimeOut(spSendTimeOut.Value);
 SetRecvTimeOut(spRecvTimeOut.Value);
 SetCurLogChk(chkLog.Checked);
 SetSeurity(cSecurity.Checked);
// SetWarning(cWarning.Checked);
 SetAutoStar(chkAutoStar.Checked); 
 SetReSend(cReSend.Checked);
 SetTimeCycle(spTimeCycle.Value);
 SetSendTry(sSendTry.Value);

//===========================================//
 LocatIPAddr  := GetLocatIPAddr;
 LocatPort    := GetLocatHostPort;
 RemoteIPAddr := GetRemoteIPAddr;
 RemotePort   := GetRemoteHostPort;
 UserName     := GetUserName;
 PassWord     := GetPassWord;
 ModalResult  := mrOk;
end;

end.

⌨️ 快捷键说明

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