home *** CD-ROM | disk | FTP | other *** search
/ Delphi Anthology / aDELPHI.iso / Runimage / Delphi50 / Demos / Midas / Login / clntfrm.pas < prev    next >
Pascal/Delphi Source File  |  1999-08-11  |  1KB  |  55 lines

  1. unit ClntFrm;
  2.  
  3. {
  4.   This is the client side of the login demo.  Using the login dialog provided by
  5.   the connection component and the OnLogin event, we pass the username and
  6.   password to the server for verification.
  7.  
  8.   Make sure you first compile and run the server portion of this demo.
  9. }
  10.  
  11. interface
  12.  
  13. uses
  14.   Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  15.   StdCtrls, Grids, DBGrids, Db, DBClient, MConnect;
  16.  
  17. type
  18.   TForm1 = class(TForm)
  19.     DCOMConnection1: TDCOMConnection;
  20.     ClientDataSet1: TClientDataSet;
  21.     DataSource1: TDataSource;
  22.     DBGrid1: TDBGrid;
  23.     Button1: TButton;
  24.     procedure Button1Click(Sender: TObject);
  25.     procedure DCOMConnection1Login(Sender: TObject; Username,
  26.       Password: String);
  27.   private
  28.     { Private declarations }
  29.   public
  30.     { Public declarations }
  31.   end;
  32.  
  33. var
  34.   Form1: TForm1;
  35.  
  36. implementation
  37.  
  38. {$R *.DFM}
  39.  
  40. procedure TForm1.Button1Click(Sender: TObject);
  41. begin
  42.   ClientDataSet1.Open;
  43. end;
  44.  
  45. procedure TForm1.DCOMConnection1Login(Sender: TObject; Username,
  46.   Password: String);
  47. begin
  48.   { Use the Login procedure that was added on the server to pass the
  49.     username and password to the server.  If your protocol is not encrypted
  50.     you may want to encrypt your password before sending it. }
  51.   DCOMConnection1.AppServer.Login(UserName, Password);
  52. end;
  53.  
  54. end.
  55.