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

📄 clientcfg_u.pas

📁 delphi实现 webservice的例子.有服务端和客户段 利用xml交互.
💻 PAS
字号:
unit clientcfg_u;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls,IniFiles;

type
  TaClentcfgForm = class(TForm)
    lbl1: TLabel;
    edt1: TEdit;
    btn1: TButton;
    btn2: TButton;

    procedure  SaveConfig;
    
    procedure btn2Click(Sender: TObject);
    procedure btn1Click(Sender: TObject);
    procedure FormShow(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;
  function ReadConfig:string;
var
  aClentcfgForm: TaClentcfgForm;

implementation
 uses
   Variable_U;
{$R *.dfm}
procedure  TaClentcfgForm.saveConfig;
var iniFile: TIniFile;
    path: array[0..1024] of Char;
    e:PChar;
begin
  StrPCopy( path,Application.ExeName );
  e := StrRScan( path,'\' );
  if e<>nil then e[0] := #0;
     IniFile := TIniFile.Create(Path+'\Client.ini');
  try
     inifile.WriteString('Server','ServiceURL',edt1.text);
  finally
     IniFile.Free;
  end;
  end;

function readConfig:string;
var iniFile: TIniFile;
    path: array[0..1024] of Char;
    e:PChar;
begin
  StrPCopy( path,Application.ExeName );
  e := StrRScan( path,'\' );
  if e<>nil then e[0] := #0;
     IniFile := TIniFile.Create(Path+'\Client.ini');
  try
    result:=inifile.ReadString('Server','ServiceURL','');
  finally
     IniFile.Free;
  end;
  end;
procedure TaClentcfgForm.btn2Click(Sender: TObject);
begin
  Self.ModalResult :=IDCANCEL;
end;

procedure TaClentcfgForm.btn1Click(Sender: TObject);
begin
  SaveConfig;
  ClientCFG.ServiceURL :=edt1.Text;
  ModalResult :=IDOK;
end;

procedure TaClentcfgForm.FormShow(Sender: TObject);
begin
  ReadConfig;
end;

end.

⌨️ 快捷键说明

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