home *** CD-ROM | disk | FTP | other *** search
/ Delphi 2 - Developers' Solutions / Delphi 2 Developers' Solutions.iso / dds / chap09 / howto02 / delphi10 / cciccfrm.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  1996-06-11  |  21.8 KB  |  632 lines

  1. unit Cciccfrm;
  2.  
  3. interface
  4.  
  5. uses
  6.   SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,
  7.   Forms, Dialogs, ExtCtrls, StdCtrls, Buttons, Menus, FileCtrl,
  8.   {Winsock,} CCWSock, CCICCInf, CCICCPrf, IniFiles, Gauges;
  9.  
  10. type
  11.   { This record holds the information for a number of internet connections }
  12.   PConnectionsRecord = ^TConnectionsRecord;
  13.   TConnectionsRecord = record
  14.     CProfile   : string; { Connection profile; used in lists }
  15.     CIPAddress : string; { Dotted character IP Address       }
  16.     CUserName  : string; { Login name to site; can be anonym }
  17.     CPassword  : string; { Password; won't be shown          }
  18.     CStartDir  : string; { Starting directory; used for FTP  }
  19.   end;
  20.   { Array of TCR }
  21.   CRFile = file of TConnectionsRecord; { File type for TCRec }
  22.   TCCINetCCForm = class(TForm)
  23.     Panel1: TPanel;
  24.     Panel2: TPanel;
  25.     Panel3: TPanel;
  26.     Panel4: TPanel;
  27.     Panel5: TPanel;
  28.     Panel6: TPanel;
  29.     ListBox1: TListBox;
  30.     Panel7: TPanel;
  31.     SpeedButton1: TSpeedButton;
  32.     SpeedButton2: TSpeedButton;
  33.     ListBox2: TListBox;
  34.     ComboBox1: TComboBox;
  35.     Button1: TButton;
  36.     Memo1: TMemo;
  37.     SpeedButton4: TSpeedButton;
  38.     SpeedButton5: TSpeedButton;
  39.     SpeedButton3: TSpeedButton;
  40.     Panel8: TPanel;
  41.     Label1: TLabel;
  42.     Label2: TLabel;
  43.     ComboBox2: TComboBox;
  44.     Label3: TLabel;
  45.     ComboBox3: TComboBox;
  46.     Label4: TLabel;
  47.     Label5: TLabel;
  48.     OpenDialog1: TOpenDialog;
  49.     SaveDialog1: TSaveDialog;
  50.     PrintDialog1: TPrintDialog;
  51.     PrinterSetupDialog1: TPrinterSetupDialog;
  52.     FindDialog1: TFindDialog;
  53.     ReplaceDialog1: TReplaceDialog;
  54.     Gauge1: TGauge;
  55.     MainMenu1: TMainMenu;
  56.     Network1: TMenuItem;
  57.     ViewWinsockInfo1: TMenuItem;
  58.     Description1: TMenuItem;
  59.     SystemStatus1: TMenuItem;
  60.     VendorSpecific1: TMenuItem;
  61.     N1: TMenuItem;
  62.     ProgressInfo1: TMenuItem;
  63.     ViewInEditWindow1: TMenuItem;
  64.     ViewInStatusLine1: TMenuItem;
  65.     SaveToFile1: TMenuItem;
  66.     N2: TMenuItem;
  67.     Exit1: TMenuItem;
  68.     Services1: TMenuItem;
  69.     IPAddress1: TMenuItem;
  70.     EMail1: TMenuItem;
  71.     FTP1: TMenuItem;
  72.     UsenetNws1: TMenuItem;
  73.     Files1: TMenuItem;
  74.     Load1: TMenuItem;
  75.     Save1: TMenuItem;
  76.     Encoding1: TMenuItem;
  77.     UUDecode1: TMenuItem;
  78.     MIMEDecode1: TMenuItem;
  79.     UUEncode1: TMenuItem;
  80.     MIMEEncode1: TMenuItem;
  81.     Edit1: TMenuItem;
  82.     Cut1: TMenuItem;
  83.     Copy1: TMenuItem;
  84.     CopytoFile1: TMenuItem;
  85.     Paste1: TMenuItem;
  86.     PastefromFile1: TMenuItem;
  87.     EMail2: TMenuItem;
  88.     CheckMail1: TMenuItem;
  89.     CreateNewMessage1: TMenuItem;
  90.     ReplyToCurrentMessage1: TMenuItem;
  91.     SendCurrentMessage1: TMenuItem;
  92.     SendQueue1: TMenuItem;
  93.     MailServers1: TMenuItem;
  94.     Mailboxes1: TMenuItem;
  95.     Correspondents1: TMenuItem;
  96.     TrashMarkedMessages1: TMenuItem;
  97.     EmptyTrash1: TMenuItem;
  98.     ExitEMailRequired1: TMenuItem;
  99.     FTP2: TMenuItem;
  100.     ConnectToSite1: TMenuItem;
  101.     Disconnect1: TMenuItem;
  102.     UploadMarked1: TMenuItem;
  103.     ASCII1: TMenuItem;
  104.     Binary1: TMenuItem;
  105.     DownloadMarked1: TMenuItem;
  106.     ASCII2: TMenuItem;
  107.     ToFile1: TMenuItem;
  108.     ToDisplay1: TMenuItem;
  109.     Binary2: TMenuItem;
  110.     Directory1: TMenuItem;
  111.     ViewRemoteasText1: TMenuItem;
  112.     ViewasText1: TMenuItem;
  113.     Change1: TMenuItem;
  114.     Create1: TMenuItem;
  115.     Delete3: TMenuItem;
  116.     ChangeLocal1: TMenuItem;
  117.     DeleteRemoteFiles1: TMenuItem;
  118.     FTPSites1: TMenuItem;
  119.     News1: TMenuItem;
  120.     ConnectandUpdate1: TMenuItem;
  121.     Disconnect2: TMenuItem;
  122.     Headers1: TMenuItem;
  123.     RetrieveMarked1: TMenuItem;
  124.     RetrieveAll1: TMenuItem;
  125.     CheckNewNews1: TMenuItem;
  126.     GetMarked1: TMenuItem;
  127.     Article1: TMenuItem;
  128.     NewArticle1: TMenuItem;
  129.     FollowupArticle1: TMenuItem;
  130.     PutinQueue1: TMenuItem;
  131.     Post1: TMenuItem;
  132.     CurrentArticle1: TMenuItem;
  133.     EntireQueue1: TMenuItem;
  134.     NewsServers1: TMenuItem;
  135.     SubscribedNewsgroups1: TMenuItem;
  136.     Trash1: TMenuItem;
  137.     AllReadArticles1: TMenuItem;
  138.     AllMarkedArticles1: TMenuItem;
  139.     AllAvailableArticles1: TMenuItem;
  140.     DownloadActiveNewsgroups1: TMenuItem;
  141.     Preferences1: TMenuItem;
  142.     EMail3: TMenuItem;
  143.     FTP3: TMenuItem;
  144.     News2: TMenuItem;
  145.     Paths1: TMenuItem;
  146.     procedure Exit1Click(Sender: TObject);
  147.     procedure FormCreate(Sender: TObject);
  148.     procedure FormDestroy(Sender: TObject);
  149.     procedure Description1Click(Sender: TObject);
  150.     procedure SystemStatus1Click(Sender: TObject);
  151.     procedure VendorSpecific1Click(Sender: TObject);
  152.     procedure ViewInEditWindow1Click(Sender: TObject);
  153.     procedure ViewInStatusLine1Click(Sender: TObject);
  154.     procedure SaveToFile1Click(Sender: TObject);
  155.     procedure IPAddress1Click(Sender: TObject);
  156.     procedure FormResize(Sender: TObject);
  157.   private
  158.     { Private declarations }
  159.   public
  160.     { Public declarations }
  161.     procedure ReadIniData;
  162.     procedure WriteIniData;
  163.     procedure AddNullTermTextToMemo( TheTextToAdd   : string;
  164.                                      TheMemoToAddTo : TMemo   );
  165.     function AddNullTermTextToLabel( TheTextToAdd   : string ) : string;
  166.     procedure AddProgressText( WhatText : string );
  167.     procedure ShowProgressText( WhatText : string );
  168.     procedure ShowProgressErrorText( WhatText : string );
  169.     procedure SocketsErrorOccurred( Sender     : TObject;
  170.                                      ErrorCode  : Integer;
  171.                                      TheMessage : string   );
  172.   end;
  173.  
  174. const
  175.   POV_MEMO                 = 1; { Progress to the Memo           }
  176.   POV_STAT                 = 2; { Progress to the status caption }
  177.   FTP_STATUS_PRELIMINARY   = 1; { Wait; command being processed  }
  178.   FTP_STATUS_COMPLETED     = 2; { Done; command fully succeded   }
  179.   FTP_STATUS_CONTINUING    = 3; { OK; send more data to finish   }
  180.   FTP_STATUS_RETRY_COMMAND = 4; { Temporary Error; try cmd again }
  181.   FTP_STATUS_FATAL_ERROR   = 5; { Fatal Error; don't retry cmd   }
  182.  
  183. var
  184.   CCINetCCForm         : TCCINetCCForm;
  185.   GlobalErrorCode      : Integer;        { Used to pass around error info  }
  186.   GlobalAbortedFlag    : Boolean;        { Used to signal timeout error    }
  187.   ProgressList         : TStringList;    { Used to hold progress text info }
  188.   ProgressFileName     : string;         { Used to hold progress file name }
  189.   ProgressOutputVector : Integer;        { Used to direct progress output  }
  190.   TheFTPSiteList       : TList;          { Used to store the FTP site recs }
  191.   TheWorkingFTPSL      : TList;          { Used to store working copy of l }
  192.   TheFTPSiteFile       : CRFile;         { Used to load the FTP site file  }
  193.   TheICCIniFile        : TIniFile;       { Used to retrieve the INI File   }
  194.   MailPath             : string;         { Used for path to Mail Files     }
  195.   NewsPath             : string;         { Used for path to News Files     }
  196.   WWWPath              : string;         { Used for path to WWW Files      }
  197.   FTPPath              : string;         { Used for path to FTP Files      }
  198.   CurrentPassWordString : string;        { Used to hold login id for anons }
  199.   PassWordControlVector : Integer;       { Used to hold display of pw vect }
  200.   CurrentRealPWString   : string;        { Used to hold a real password    }
  201.   TheLine ,
  202.   HolderLine ,
  203.   GlobalTextBuffer      : string;
  204.   TheAnonRedialVector ,
  205.   DefaultDownloadVector : Integer;
  206.   LeftoverText          : string;
  207.   LeftoversOnTable      : Boolean;
  208.   FileNameToXFer        : string;
  209.  
  210. implementation
  211.  
  212. {$R *.DFM}
  213.  
  214.  
  215.  
  216. { This procedure reads in the ini file and default path info }
  217. procedure TCCINetCCForm.ReadIniData;
  218. begin
  219.   TheICCIniFile := TIniFile.Create( 'CCICC.INI' );
  220.   MailPath := TheICCIniFile.ReadString( 'Paths','MailPath','C:\WINDOWS' );
  221.   NewsPath := TheICCIniFile.ReadString( 'Paths','NewsPath','C:\WINDOWS' );
  222.   WWWPath := TheICCIniFile.ReadString( 'Paths','WWWPath','C:\WINDOWS' );
  223.   FTPPath := TheICCIniFile.ReadString( 'Paths','FTPPath','C:\WINDOWS' );
  224.   PasswordControlVector := TheICCIniFile.ReadInteger( 'Vectors','PWControl',2 );
  225.   DefaultDownloadVector := TheICCIniFile.ReadInteger( 'Vectors','DefDL', 3 );
  226.   TheAnonRedialVector := TheICCIniFile.ReadInteger( 'Vectors','AnonRD', 20 );
  227.   TheICCIniFile.Free;
  228. end;
  229.  
  230. { This procedure writes out default path data to the ini file }
  231. procedure TCCINetCCForm.WriteIniData;
  232. begin
  233.   TheICCIniFile := TIniFile.Create( 'CCICC.INI' );
  234.   TheICCIniFile.WriteString( 'Paths','MailPath',MailPath );
  235.   TheICCIniFile.WriteString( 'Paths','NewsPath',NewsPath );
  236.   TheICCIniFile.WriteString( 'Paths','WWWPath',WWWPath );
  237.   TheICCIniFile.WriteString( 'Paths','FTPPath',FTPPath );
  238.   TheICCIniFile.WriteInteger( 'Vectors','PWControl',PasswordControlVector );
  239.   TheICCIniFile.WriteInteger( 'Vectors','DefDL',DefaultDownloadVector );
  240.   TheICCIniFile.WriteInteger( 'Vectors','AnonRD', TheAnonRedialVector );
  241.   TheICCIniFile.Free;
  242. end;
  243.  
  244. { This procedure scans a line of UNIX-style text for #10's and }
  245. { outputs them as lines to the memo. It stops at #0.           }
  246. procedure TCCINetCCForm.AddNullTermTextToMemo( TheTextToAdd   : string;
  247.                                  TheMemoToAddTo : TMemo   );
  248. var
  249.   TextLength ,            { Total chars to output         }
  250.   Counter_1    : Integer; { Loop Index                    }
  251. begin
  252.   { Make the target memo visible just in case }
  253.   TheMemoToAddTo.Visible := true;
  254.   { Find total chars to output }
  255.   TextLength := Length( TheTextToAdd );
  256.   { If none then leave }
  257.   if TextLength = 0 then exit;
  258.   { Loop along the string }
  259.   for Counter_1 := 1 to TextLength do
  260.   begin
  261.     { If hit ASCII 10 then assume end of line and output }
  262.     if TheTextToAdd[ Counter_1 ] = #10 then
  263.     begin
  264.       { Use a try loop incase memo fills up }
  265.       try
  266.         { Add the line }
  267.         TheMemoToAddTo.Lines.Add( TheLine );
  268.       except
  269.         { If memo fills up }
  270.         on EOutOfResources do
  271.         begin
  272.           { Clear the old data }
  273.           TheMemoToAddTo.Clear;
  274.           { Output the new }
  275.           TheMemoToAddTo.Lines.Add( TheLine );
  276.         end;
  277.       end;
  278.       { clear the output buffer }
  279.       TheLine := '';
  280.     end
  281.     else
  282.     { Otherwise look for null terminator from Winsock }
  283.     begin
  284.       { If don't hit null terminator then add the char to op buffer }
  285.       if TheTextToAdd[ Counter_1 ] <> #0 then
  286.       begin
  287.         TheLine := TheLine + TheTextToAdd[ Counter_1 ];
  288.       end
  289.       else
  290.       begin
  291.         if TheLine <> '' then
  292.         begin
  293.           { Use a try loop incase memo fills up }
  294.           try
  295.             { Add the line }
  296.             TheMemoToAddTo.Lines.Add( TheLine );
  297.           except
  298.             { If memo fills up }
  299.             on EOutOfResources do
  300.             begin
  301.               { Clear the old data }
  302.               TheMemoToAddTo.Clear;
  303.               { Output the new }
  304.               TheMemoToAddTo.Lines.Add( TheLine );
  305.             end;
  306.           end;
  307.           { clear the output buffer }
  308.           TheLine := '';
  309.         end;
  310.       end;
  311.     end;
  312.   end;
  313. end;
  314.  
  315. { This function scans a line of UNIX-style text for #10's and }
  316. { outputs the first line as its return value,stopping at #0.  }
  317. function TCCINetCCForm.AddNullTermTextToLabel( TheTextToAdd   : string ) : string;
  318. var
  319.   TheLine      : string;  { Buffer to output current line }
  320.   TextLength ,            { Total chars to output         }
  321.   Counter_1    : Integer; { Loop Index                    }
  322. begin
  323.   { Clear output buffer }
  324.   TheLine := '';
  325.   { Find total chars to output }
  326.   TextLength := Length( TheTextToAdd );
  327.   { If none then leave }
  328.   if TextLength = 0 then
  329.   begin
  330.     { Return nothing }
  331.     Result := '';
  332.     { Leave }
  333.     exit;
  334.   end;
  335.   { Loop along the string }
  336.   for Counter_1 := 1 to TextLength do
  337.   begin
  338.     { If hit ASCII 10 then assume end of line and output }
  339.     if TheTextToAdd[ Counter_1 ] = #10 then
  340.     begin
  341.       { Return first line }
  342.       Result := TheLine;
  343.       { Leave }
  344.       exit;
  345.     end
  346.     else
  347.     { Otherwise look for null terminator from Winsock }
  348.     begin
  349.       { If don't hit null terminator then add the char to op buffer }
  350.       if TheTextToAdd[ Counter_1 ] <> #0 then
  351.       begin
  352.         TheLine := TheLine + TheTextToAdd[ Counter_1 ];
  353.       end
  354.       else break; { Otherwise drop out of the loop }
  355.     end;
  356.   end;
  357.   { If hit #0 before #10 return buffer }
  358.   Result := TheLine;
  359. end;
  360.  
  361. { Exit method }
  362. procedure TCCINetCCForm.Exit1Click(Sender: TObject);
  363. begin
  364.   Close;
  365. end;
  366.  
  367. { This method adds a line to the progress text stringlist  }
  368. { If an exception occurs, the list is full, and it is auto }
  369. { saved to the progress text file name, then cleared.      }
  370. procedure TCCINetCCForm.AddProgressText( WhatText : string );
  371. begin
  372.   { Use a try..except loop to catch list overflows }
  373.   try
  374.     { Try the normal add }
  375.     ProgressList.Add( WhatText );
  376.   except
  377.     { Any list error is assumed to be a list overflow }
  378.     on EListError do
  379.     begin
  380.       { Save the list to the preset file name }
  381.       ProgressList.SaveToFile( ProgressFileName );
  382.       { Clear the list to make more room }
  383.       ProgressList.Clear;
  384.       { And redo the add; any further errors will except normally }
  385.       ProgressList.Add( WhatText );
  386.     end;
  387.     { This might happen too! }
  388.     on EOutOfResources do
  389.     begin
  390.       { Save the list to the preset file name }
  391.       ProgressList.SaveToFile( ProgressFileName );
  392.       { Clear the list to make more room }
  393.       ProgressList.Clear;
  394.       { And redo the add; any further errors will except normally }
  395.       ProgressList.Add( WhatText );
  396.     end;
  397.   end;
  398. end;
  399.  
  400. { This method either adds the progress line to the current memo }
  401. { or puts it in the status caption at normal colors.            }
  402. procedure TCCINetCCForm.ShowProgressText( WhatText : string );
  403. begin
  404.   { Use the POV to determine where to show progress info }
  405.   case ProgressOutputVector of
  406.     POV_MEMO : begin { Output into the memo  }
  407.                  AddNullTermTextToMemo( WhatText , Memo1 );
  408.                end;
  409.     POV_STAT : begin { Output on status line }
  410.                  { Set panel caption font to black }
  411.                  Panel1.Font.Color := clBlack;
  412.                  { Get the first line of text and put in caption }
  413.                  Panel1.Caption := AddNullTermTextToLabel( WhatText );
  414.                end;
  415.   end;
  416. end;
  417.  
  418. { This method is identical with SPT except sets status color to red and beeps }
  419. procedure TCCINetCCForm.ShowProgressErrorText( WhatText : string );
  420. begin
  421.   { Do error beep }
  422.   MessageBeep( mb_IconExclamation );
  423.   { Use the POV to determine where to show progress info }
  424.   case ProgressOutputVector of
  425.     POV_MEMO : begin { Output into the memo  }
  426.                  AddNullTermTextToMemo( WhatText , Memo1 );
  427.                end;
  428.     POV_STAT : begin { Output on status line }
  429.                  { Set panel caption font to black }
  430.                  Panel1.Font.Color := clRed;
  431.                  { Get the first line of text and put in caption }
  432.                  Panel1.Caption := AddNullTermTextToLabel( WhatText );
  433.                end;
  434.   end;
  435. end;
  436.  
  437. { This is the boilerplate method used to handle Socket errors gracefully }
  438. procedure TCCINetCCForm.SocketsErrorOccurred( Sender     : TObject;
  439.                                               ErrorCode  : Integer;
  440.                                               TheMessage : string   );
  441. begin
  442.   { Set the global error code flag }
  443.   GlobalErrorCode := ErrorCode;
  444.   { If a timeout error }
  445.   if ErrorCode = WSAETIMEDOUT then
  446.   begin
  447.     { Set the aborted flag }
  448.     GlobalAbortedFlag := True;
  449.     { But clear the error code for graceful handling }
  450.     GlobalErrorCode := 0;
  451.   end
  452.   else
  453.   begin
  454.     { Otherwise set the progress buffer to the error message }
  455.     AddProgressText( TheMessage );
  456.     { And show the progress text as set by option }
  457.     ShowProgressErrorText( TheMessage );
  458.   end;
  459. end;
  460.  
  461. procedure TCCINetCCForm.FormCreate(Sender: TObject);
  462. begin
  463.   { Create the progress string list }
  464.   ProgressList := TStringList.Create;
  465.   { Create the file name for saving the progress list }
  466.   ProgressFileName := ExpandFileName( 'PROGRESS.TXT' );
  467.   { Default progress output to status line }
  468.   ProgressOutputVector := POV_STAT;
  469.   { Set password control stuff }
  470.   PasswordControlVector := 2;
  471.   CurrentPasswordString := 'guest@nowhere.com';
  472.   CurrentRealPWString := 'guest@nowhere.com';
  473.   { Get Ini file Data }
  474.   ReadIniData;
  475. end;
  476.  
  477. procedure TCCINetCCForm.FormDestroy(Sender: TObject);
  478. begin
  479.   { Free the progress text stringlist if assigned }
  480.   if assigned( ProgressList ) then ProgressList.Free;
  481.   { Save off the Ini data }
  482.   WriteIniData;
  483. end;
  484.  
  485. procedure TCCINetCCForm.Description1Click(Sender: TObject);
  486. var
  487.   TempSocket : TCCSocket; { Temporary socket just to get Winsock info }
  488.   TheData    : string;    { Holder for data                           }
  489. begin
  490.   { Create socket; auto calls WSAStartup }
  491.   TempSocket := TCCSocket.Create( Self );
  492.   { Do parent just for kicks; no longer needed }
  493.   TempSocket.Parent := self;
  494.   { Put in error handler }
  495.   TempSocket.OnErrorOccurred := SocketsErrorOccurred;
  496.   TheData := StrPas( TempSocket.Socket_WSA_Data.Description_String );
  497.   { Display the Description string }
  498.   AddProgressText( TheData + #0 );
  499.   { And show the progress text as set by option }
  500.   ShowProgressText( TheData + #0 );
  501.   { Free the socket; auto calls WSACleanup }
  502.   TempSocket.Free;
  503. end;
  504.  
  505. procedure TCCINetCCForm.SystemStatus1Click(Sender: TObject);
  506. var
  507.   TempSocket : TCCSocket; { Temporary socket just to get Winsock info }
  508.   TheData    : string;    { Holder for data                           }
  509. begin
  510.   { Create socket; auto calls WSAStartup }
  511.   TempSocket := TCCSocket.Create( Self );
  512.   { Do parent just for kicks; no longer needed }
  513.   TempSocket.Parent := self;
  514.   { Put in error handler }
  515.   TempSocket.OnErrorOccurred := SocketsErrorOccurred;
  516.   TheData := StrPas( TempSocket.Socket_WSA_Data.System_Status_String );
  517.   { Display the Description string }
  518.   AddProgressText( TheData + #0 );
  519.   { And show the progress text as set by option }
  520.   ShowProgressText( TheData + #0 );
  521.   { Free the socket; auto calls WSACleanup }
  522.   TempSocket.Free;
  523. end;
  524.  
  525. procedure TCCINetCCForm.VendorSpecific1Click(Sender: TObject);
  526. var
  527.   TempSocket : TCCSocket; { Temporary socket just to get Winsock info }
  528.   TheData    : string;    { Holder for data                           }
  529. begin
  530.   { Create socket; auto calls WSAStartup }
  531.   TempSocket := TCCSocket.Create( Self );
  532.   { Do parent just for kicks; no longer needed }
  533.   TempSocket.Parent := self;
  534.   { Put in error handler }
  535.   TempSocket.OnErrorOccurred := SocketsErrorOccurred;
  536.   TheData := StrPas( TempSocket.Socket_WSA_Data.Vendor_Specific_String );
  537.   { Display the Description string }
  538.   AddProgressText( TheData + #0 );
  539.   { And show the progress text as set by option }
  540.   ShowProgressText( TheData + #0 );
  541.   { Free the socket; auto calls WSACleanup }
  542.   TempSocket.Free;
  543. end;
  544.  
  545. { This method sets the progress output vector to the memo }
  546. procedure TCCINetCCForm.ViewInEditWindow1Click(Sender: TObject);
  547. begin
  548.   { Set the vector }
  549.   ProgressOutputVector := POV_MEMO;
  550.   { Keep the menu options consistent }
  551.   ViewInEditWindow1.Checked := true;
  552.   ViewInStatusLine1.Checked := false;
  553. end;
  554.  
  555. { This method sets the progress output vector to the status line }
  556. procedure TCCINetCCForm.ViewInStatusLine1Click(Sender: TObject);
  557. begin
  558.   { Set the vector }
  559.   ProgressOutputVector := POV_STAT;
  560.   { Keep the menus consistent }
  561.   ViewInEditWindow1.Checked := false;
  562.   ViewInStatusLine1.Checked := true;
  563. end;
  564.  
  565. procedure TCCINetCCForm.SaveToFile1Click(Sender: TObject);
  566. begin
  567.   { Set up the dialog parameters }
  568.   OpenDialog1.Filename := ProgressFileName;
  569.   OpenDialog1.Title := 'Select Filename for Progress File';
  570.   OpenDialog1.Filter := 'Text Files|*.txt';
  571.   { If the dialog is not cancelled then save and clear }
  572.   if OpenDialog1.Execute then
  573.   begin
  574.     ProgressFileName := OpenDialog1.FileName;
  575.     ProgressList.SaveToFile( ProgressFileName );
  576.     ProgressList.Clear;
  577.   end;
  578. end;
  579.  
  580. procedure TCCINetCCForm.IPAddress1Click(Sender: TObject);
  581. begin
  582.   { Set up info dialog for IP Address getting }
  583.   CCICInfoDlg.Caption := 'CC Internet Center -- Translate IP Address';
  584.   CCICInfoDlg.Panel4.Visible := false;
  585.   CCICInfoDlg.Panel6.Visible := false;
  586.   CCICInfoDlg.Panel9.Visible := false;
  587.   CCICInfoDlg.Panel8.Visible := false;
  588.   CCICInfoDlg.BitBtn2.Visible := false;
  589.   CCICInfoDlg.Button1.Caption := 'Get IP Address';
  590.   CCICInfoDlg.Button2.Visible := false;
  591.   CCICInfoDlg.Button3.Visible := false;
  592.   CCICInfoDlg.Button4.Visible := false;
  593.   CCICInfoDlg.Panel2.Caption := 'IP Addr Name:';
  594.   CCICInfoDlg.Panel3.Caption := '    Dotted Dec:';
  595.   CCICInfoDlg.Panel5.Caption := '           Binary:';
  596.   CCICInfoDlg.Edit1.Text := '';
  597.   CCICInfoDlg.Edit2.Text := '';
  598.   CCICInfoDlg.Edit3.Text := '';
  599.   { Set IP Address Mode }
  600.   CCICInfoDlg.Tag := 1;
  601.   { Show Modally to get the information }
  602.   CCICInfoDlg.ShowModal;
  603.   { Reset the info dialog to default conditions }
  604.   CCICInfoDlg.Caption := 'CC Internet Command Center Information Dialog';
  605.   CCICInfoDlg.Panel4.Visible := true;
  606.   CCICInfoDlg.Panel6.Visible := true;
  607.   CCICInfoDlg.Panel9.Visible := true;
  608.   CCICInfoDlg.Panel8.Visible := true;
  609.   CCICInfoDlg.BitBtn2.Visible := true;
  610.   CCICInfoDlg.Button1.Caption := 'Anonymous Login';
  611.   CCICInfoDlg.Button2.Visible := true;
  612.   CCICInfoDlg.Button3.Visible := true;
  613.   CCICInfoDlg.Button4.Visible := true;
  614.   CCICInfoDlg.Panel2.Caption := '             Name:';
  615.   CCICInfoDlg.Panel3.Caption := '    IP Address:';
  616.   CCICInfoDlg.Panel5.Caption := ' User Name:';
  617.   CCICInfoDlg.Edit1.Text := '';
  618.   CCICInfoDlg.Edit2.Text := '';
  619.   CCICInfoDlg.Edit3.Text := '';
  620. end;
  621.  
  622. procedure TCCINetCCForm.FormResize(Sender: TObject);
  623. begin
  624.   { Use tag vector to determine what to do }
  625.   case Tag of
  626.     { if FTP , make sure two list boxes are same height }
  627.     2 : Panel6.Height := (( Panel4.Height div 2 ) - 30 );
  628.   end;
  629. end;
  630.  
  631. end.
  632.