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

📄 rasdial3.pas

📁 < Delphi网络通信协议分析与应用实现>>一书的源代码。
💻 PAS
📖 第 1 页 / 共 2 页
字号:
{* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

Copyright: Fran鏾is Piette
           This program can be used/modified freely provided this copyright
           notice remains here. If you like my code, find any bug or
           improve it, please feels free to let me know by sending an EMail at
           francois.piette@ping.be or francois.piette@f2202.n293.z2.fidonet.org


 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *}
unit RasDial3;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  Formauto, StdCtrls, ShellApi, RasDial4;

type
  TConfigureAutoForm = class(TAutoForm)
    OkButton: TButton;
    CancelButton: TButton;
    AutoPasswordCheckBox: TCheckBox;
    AutoUserNameCheckBox: TCheckBox;
    GroupBox1: TGroupBox;
    AutoExecuteBrowserCheckBox: TCheckBox;
    BrowserExeEdit: TEdit;
    BrowserDirEdit: TEdit;
    GroupBox2: TGroupBox;
    AutoExecuteMailCheckBox: TCheckBox;
    MailExeEdit: TEdit;
    MailDirEdit: TEdit;
    GroupBox3: TGroupBox;
    AutoExecuteNewsCheckBox: TCheckBox;
    NewsExeEdit: TEdit;
    NewsDirEdit: TEdit;
    Label1: TLabel;
    Label2: TLabel;
    Label3: TLabel;
    Label4: TLabel;
    Label5: TLabel;
    Label6: TLabel;
    AutoConnectCheckBox: TCheckBox;
    MonthlyDurationCheckBox: TCheckBox;
    procedure CancelButtonClick(Sender: TObject);
    procedure OkButtonClick(Sender: TObject);
    procedure AutoExecuteBrowserCheckBoxClick(Sender: TObject);
    procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean);
  private
    { Private declarations }
    function  GetAutoUserName : Boolean;
    procedure SetAutoUserName(newValue : Boolean);
    function  GetAutoConnect : Boolean;
    procedure SetAutoConnect(newValue : Boolean);
    function  GetAutoPassword : Boolean;
    procedure SetAutopassword(newValue : Boolean);
    function  GetAutoExecuteBrowser : Boolean;
    function  GetAutoExecuteMail : Boolean;
    function  GetAutoExecuteNews : Boolean;
    procedure SetAutoExecuteBrowser(newValue : Boolean);
    procedure SetAutoExecuteMail(newValue : Boolean);
    procedure SetAutoExecuteNews(newValue : Boolean);
    function  GetMonthlyDuration : Boolean;
    procedure SetMonthlyDuration(newValue : Boolean);
    function  GetBrowserExe : String;
    function  GetMailExe : String;
    function  GetNewsExe : String;
    function  GetBrowserDir : String;
    function  GetMailDir : String;
    function  GetNewsDir : String;
    procedure SetBrowserExe(newValue : String);
    procedure SetMailExe(newValue : String);
    procedure SetNewsExe(newValue : String);
    procedure SetBrowserDir(newValue : String);
    procedure SetMailDir(newValue : String);
    procedure SetNewsDir(newValue : String);
    procedure ExecuteProg(Exe, Dir : String);
  public
    { Public declarations }
    procedure Configure;
    procedure ExecuteBrowser;
    procedure ExecuteMail;
    procedure ExecuteNews;
    procedure ExecuteBrowserAuto;
    procedure ExecuteMailAuto;
    procedure ExecuteNewsAuto;
    property AutoConnect : Boolean  read GetAutoConnect  write SetAutoConnect;
    property AutoUserName : Boolean read GetAutoUserName write SetAutoUserName;
    property AutoPassword : Boolean read GetAutoPassword write SetAutopassword;
    property AutoExecuteBrowser : Boolean read GetAutoExecuteBrowser write SetAutoExecuteBrowser;
    property AutoExecuteMail : Boolean read GetAutoExecuteMail write SetAutoExecuteMail;
    property AutoExecuteNews : Boolean read GetAutoExecuteNews write SetAutoExecuteNews;
    property MonthlyDuration : Boolean read GetMonthlyDuration write SetMonthlyDuration;
    property BrowserExe : String             read GetBrowserExe write SetBrowserExe;
    property MailExe : String                read GetMailExe    write SetMailExe;
    property NewsExe : String                read GetNewsExe    write SetNewsExe;
    property BrowserDir : String             read GetBrowserDir write SetBrowserDir;
    property MailDir : String                read GetMailDir    write SetMailDir;
    property NewsDir : String                read GetNewsDir    write SetNewsDir;
  end;

var
  ConfigureAutoForm: TConfigureAutoForm;

implementation

{$R *.DFM}


{* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *}
procedure TConfigureAutoForm.Configure;
var
    OldAutoConnect     : Boolean;
    OldAutoPassword    : Boolean;
    OldAutoUserName    : Boolean;
    OldExecuteBrowser  : Boolean;
    OldExecuteMail     : Boolean;
    OldExecuteNews     : Boolean;
    OldMonthlyDuration : Boolean;
    OldBrowserExe      : String;
    OldBrowserDir      : String;
    OldMailExe         : String;
    OldMailDir         : String;
    OldNewsExe         : String;
    OldNewsDir         : String;
begin
    OldAutoConnect     := AutoConnectCheckBox.Checked;
    OldAutoPassword    := AutoPasswordCheckBox.Checked;
    OldAutoUserName    := AutoUserNameCheckBox.Checked;
    OldExecuteBrowser  := AutoExecuteBrowserCheckBox.Checked;
    OldExecuteMail     := AutoExecuteMailCheckBox.Checked;
    OldExecuteNews     := AutoExecuteNewsCheckBox.Checked;
    OldMonthlyDuration := MonthlyDurationCheckBox.Checked;
    OldBrowserExe      := BrowserExeEdit.Text;
    OldBrowserDir      := BrowserDirEdit.Text;
    OldMailExe         := MailExeEdit.Text;
    OldMailDir         := MailDirEdit.Text;
    OldNewsExe         := NewsExeEdit.Text;
    OldNewsDir         := NewsDirEdit.Text;

    if ShowModal <> mrOk then begin
        AutoConnectCheckBox.Checked        := OldAutoConnect;
        AutoPasswordCheckBox.Checked       := OldAutoPassword;
        AutoUserNameCheckBox.Checked       := OldAutoUserName;
        AutoExecuteBrowserCheckBox.Checked := OldExecuteBrowser;
        AutoExecuteMailCheckBox.Checked    := OldExecuteMail;
        AutoExecuteNewsCheckBox.Checked    := OldExecuteNews;
        MonthlyDurationCheckBox.Checked    := OldMonthlyDuration;
        BrowserExeEdit.Text                := OldBrowserExe;
        BrowserDirEdit.Text                := OldBrowserDir;
        MailExeEdit.Text                   := OldMailExe;
        MailDirEdit.Text                   := OldMailDir;
        NewsExeEdit.Text                   := OldNewsExe;
        NewsDirEdit.Text                   := OldNewsDir;
    end;
end;


{* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *}
procedure TConfigureAutoForm.FormCloseQuery(Sender: TObject;
  var CanClose: Boolean);
begin
    inherited;
    if ModalResult <> mrOk then begin
        if Application.MessageBox('Quit without saving ?', 'Warning',
                                  mb_YESNO + mb_DEFBUTTON2) <> IDYES then
            canClose := FALSE;
    end;
end;


{* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *}
function TConfigureAutoForm.GetBrowserExe : String;
begin
    Result := Trim(BrowserExeEdit.Text);
end;


{* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *}
function TConfigureAutoForm.GetMailExe : String;
begin
    Result := Trim(MailExeEdit.Text);
end;


{* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *}
function TConfigureAutoForm.GetNewsExe : String;
begin
    Result := Trim(NewsExeEdit.Text);
end;


{* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *}
function TConfigureAutoForm.GetBrowserDir : String;
begin
    Result := Trim(BrowserDirEdit.Text);
end;


{* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *}
function TConfigureAutoForm.GetMailDir : String;
begin
    Result := Trim(MailDirEdit.Text);
end;


{* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *}
function TConfigureAutoForm.GetNewsDir : String;
begin
    Result := Trim(NewsDirEdit.Text);
end;


{* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *}
procedure TConfigureAutoForm.SetBrowserExe(newValue : String);
begin
    BrowserExeEdit.Text := newValue;
end;


{* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *}
procedure TConfigureAutoForm.SetNewsExe(newValue : String);
begin
    NewsExeEdit.Text := newValue;
end;


{* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *}
procedure TConfigureAutoForm.SetMailExe(newValue : String);
begin
    MailExeEdit.Text := newValue;
end;


{* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *}
procedure TConfigureAutoForm.SetBrowserDir(newValue : String);
begin
    BrowserDirEdit.Text := newValue;
end;


{* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *}
procedure TConfigureAutoForm.SetNewsDir(newValue : String);
begin
    NewsDirEdit.Text := newValue;
end;

⌨️ 快捷键说明

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