Pop3ServerFrm.pas
上传用户:hylc_2004
上传日期:2014-01-23
资源大小:46800k
文件大小:3k
源码类别:

Delphi控件源码

开发平台:

Delphi

  1. unit Pop3ServerFrm;
  2. interface
  3. uses
  4.   Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,Dialogs,
  5.   StdCtrls, ExtCtrls, ComCtrls,Registry,WNDES;
  6. type
  7.   TPop3ServerForm = class(TForm)
  8.     BTOK: TButton;
  9.     BTCancel: TButton;
  10.     GroupBox1: TGroupBox;
  11.     Label1: TLabel;
  12.     Edit1: TEdit;
  13.     Label2: TLabel;
  14.     Label3: TLabel;
  15.     Edit3: TEdit;
  16.     Label4: TLabel;
  17.     Edit4: TEdit;
  18.     Edit2: TEdit;
  19.     UpDown1: TUpDown;
  20.     procedure BTCancelClick(Sender: TObject);
  21.     procedure BTOKClick(Sender: TObject);
  22.     procedure FormShow(Sender: TObject);
  23.   private
  24.     { Private declarations }
  25.   public
  26.     { Public declarations }
  27.   end;
  28. var
  29.   Pop3ServerForm: TPop3ServerForm;
  30. implementation
  31. uses
  32.   RealMessengerUnit,RealMessengerImpl;
  33. {$R *.dfm}
  34. procedure TPop3ServerForm.BTCancelClick(Sender: TObject);
  35. begin
  36.   Close;
  37. end;
  38. procedure TPop3ServerForm.BTOKClick(Sender: TObject);
  39. var
  40.   TempReg:TRegistry;
  41. begin
  42.   if Trim(Edit1.Text)='' then
  43.   begin
  44.     MessageBox(Handle,'请输入POP3 邮件服务器地址!','提示',MB_ICONINFORMATION);
  45.     Exit;
  46.   end;
  47.   if Trim(Edit2.Text)='' then
  48.   begin
  49.     MessageBox(Handle,'请输入POP3 邮件服务器端口号!','提示',MB_ICONINFORMATION);
  50.     Exit;
  51.   end;
  52.   try
  53.     StrToInt(Trim(Edit2.Text));
  54.   except
  55.     MessageBox(Handle,'POP3 邮件服务器端口必须为数字!','提示',MB_ICONINFORMATION);
  56.     Exit;
  57.   end;
  58.   
  59.   if Trim(Edit3.Text)='' then
  60.   begin
  61.     MessageBox(Handle,'请输入POP3 邮件服务器帐号!','提示',MB_ICONINFORMATION);
  62.     Exit;
  63.   end;
  64.   if Trim(Edit4.Text)='' then
  65.   begin
  66.     MessageBox(Handle,'请输入POP3 邮件服务器密码!','提示',MB_ICONINFORMATION);
  67.     Exit;
  68.   end;
  69.     TempReg:=TRegistry.Create;
  70.     try
  71.       TempReg.RootKey:=HKEY_LOCAL_MACHINE;
  72.       if TempReg.OpenKey(AppKey+''+Me.LoginName+'Init', True) then
  73.       begin
  74.         TempReg.WriteString('POP3Server',Trim(Edit1.Text));
  75.         TempReg.WriteString('POP3Port',Trim(Edit2.Text));
  76.         TempReg.WriteString('POP3User',Trim(Edit3.Text));
  77.         TempReg.WriteString('POP3Pass',EncryStrHex(Trim(Edit4.Text),DESKEY));
  78.         RealMessengerX.ClientPOP3.Host            := Trim(Edit1.Text);
  79.         RealMessengerX.ClientPOP3.Port            := StrToInt(Trim(Edit2.Text));
  80.         RealMessengerX.ClientPOP3.Username        := Trim(Edit3.Text);
  81.         RealMessengerX.ClientPOP3.Password        := Trim(Edit4.Text);    
  82.       end;
  83.     finally
  84.       TempReg.Free;
  85.     end;
  86.     ModalResult:=mrOK;
  87. end;
  88. procedure TPop3ServerForm.FormShow(Sender: TObject);
  89. begin
  90.   Edit1.text:=RealMessengerX.ClientPOP3.Host;
  91.   Edit2.text:=IntToStr(RealMessengerX.ClientPOP3.Port);
  92.   Edit3.text:=RealMessengerX.ClientPOP3.Username;
  93.   Edit4.text:=RealMessengerX.ClientPOP3.Password;
  94. end;
  95. end.