home *** CD-ROM | disk | FTP | other *** search
/ Chip 1999 March / Chip_1999-03_cd.bin / zkuste / delphi / INFO / DI9807BL.ZIP / Intf / Server / MainFrm.pas < prev   
Pascal/Delphi Source File  |  1998-05-08  |  1KB  |  57 lines

  1. { *****************************************************************************
  2.   Implementing COM Component Callbacks in Delphi
  3.   Code written for Delphi Informant publication
  4.  
  5.   Comments, questions, suggestions?
  6.   Binh Ly, Systems Analyst (bly@brickhouse.com)
  7.   Brickhouse Data Systems (http://www.brickhouse.com)
  8.   *****************************************************************************
  9. }
  10. unit MainFrm;
  11.  
  12. interface
  13.  
  14. uses
  15.   Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs;
  16.  
  17. type
  18.   TfrmMain = class(TForm)
  19.     procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean);
  20.   private
  21.     { Private declarations }
  22.   public
  23.     { Public declarations }
  24.   end;
  25.  
  26. var
  27.   frmMain: TfrmMain;
  28.  
  29. implementation
  30.  
  31. {$R *.DFM}
  32.  
  33. uses
  34.   ChatConnection
  35.   ;
  36.  
  37. procedure TfrmMain.FormCloseQuery(Sender: TObject; var CanClose: Boolean);
  38. var
  39.   mr : integer;
  40. begin
  41.   { ensure we ask user if there are still active connections before terminating }  
  42.   if (ChatConnections > 0) then
  43.   begin
  44.     mr := MessageDlg (
  45.       Format (
  46.         'Chat server has %d active connection(s). Terminating this application will cause connected clients to fail.'#13 +
  47.         'Do you want to terminate anyway?',
  48.         [ChatConnections]
  49.       ), mtConfirmation, [mbYes, mbNo], 0
  50.     );
  51.  
  52.     CanClose := (mr = mrYes);
  53.   end;  { if }
  54. end;
  55.  
  56. end.
  57.