Advertisement
dridi4336

APPLICATION WITH PASSWORD

Mar 27th, 2015
256
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Delphi 2.55 KB | None | 0 0
  1. unit Unit1;
  2.  
  3. interface
  4.  
  5. uses
  6.   unit2,Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  7.   Dialogs, EnhEdit, StdCtrls, SRGrad, Mask, DBCtrls, Grids, DBGrids,
  8.   ExtCtrls;
  9.  
  10. type
  11.   Tform1 = class(TForm)
  12.     Button1: TButton;
  13.     Edit1: TEdit;
  14.     Label1: TLabel;
  15.     Button2: TButton;
  16.     DBEdit1: TDBEdit;
  17.     DBGrid1: TDBGrid;
  18.     Label2: TLabel;
  19.     Image1: TImage;
  20.     procedure Button2Click(Sender: TObject);
  21.     procedure Button1Click(Sender: TObject);
  22.     procedure FormCreate(Sender: TObject);
  23.     procedure FormActivate(Sender: TObject);
  24.     procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean);
  25.     procedure Edit1KeyPress(Sender: TObject; var Key: Char);
  26.  
  27.  private
  28.     { Déclarations privées }
  29.  
  30.  
  31.      public
  32.     { Déclarations publiques }
  33.  
  34.   end;
  35.  
  36.  
  37.  
  38. var
  39.   form1: Tform1;
  40.    bol:boolean;
  41. implementation
  42.  
  43. uses Unit3;
  44.  
  45.  
  46.  
  47.  function ChangeResolution(Width, Height: integer): Longint;
  48.     var
  49.     Affich: TDeviceMode;
  50.     begin
  51.         Affich.dmSize := SizeOf(TDeviceMode);//Paramètres
  52.         Affich.dmPelsWidth := Width;
  53.         Affich.dmPelsHeight := Height;
  54.         Affich.dmFields := DM_PELSWIDTH or DM_PELSHEIGHT;
  55.     Result := ChangeDisplaySettings(Affich, CDS_UPDATEREGISTRY);//Applique avec l'Api windows
  56. end;
  57.  
  58. {$R *.dfm}
  59.  
  60. procedure Tform1.Button2Click(Sender: TObject);
  61. begin
  62. application.Terminate;
  63. end;
  64.  
  65. procedure Tform1.Button1Click(Sender: TObject);
  66. begin
  67.  
  68. if (edit1.Text =  dbedit1.Text)   then
  69.   begin
  70.   bol:=true;
  71.   close;
  72.   form2.SetFocus;
  73.   end;
  74.  
  75. if (edit1.Text <> dbedit1.Text)   then
  76.    begin
  77.    bol:=false;
  78.    edit1.Text:='';
  79.    messagedlg( 'ÊÃßÜÜÏ ãä ßáãÉ ÇáÓÜÜÑ   reintroduiser' ,mtwarning,[mbok],0);
  80.    edit1.SetFocus;
  81.    end;
  82. end;
  83.  
  84. procedure Tform1.FormCreate(Sender: TObject);
  85.  
  86.  
  87. begin
  88.  
  89.  
  90.  
  91. ChangeResolution(1280,1024);
  92.  
  93. end;
  94.  
  95. procedure Tform1.FormActivate(Sender: TObject);
  96. begin
  97. bdds.mot.Open;
  98. edit1.SetFocus;
  99. edit1.Text:='';
  100. end;
  101.  
  102. procedure TForm1.FormCloseQuery(Sender: TObject; var CanClose: boolean);
  103. begin
  104.   if  (edit1.Text=dbedit1.Text)  and (bol = true)   then
  105.  
  106.        begin
  107.        CanClose := true;
  108.        close;
  109.        bdds.mot.close;
  110.        end;
  111.  
  112.   if  (edit1.Text<>dbedit1.Text) and (bol = false)  then
  113.  
  114.        begin
  115.        CanClose := false;
  116.  
  117.        end;
  118. end;
  119.  
  120. procedure Tform1.Edit1KeyPress(Sender: TObject; var Key: Char);
  121. begin
  122. if key =#13 then
  123. button1.OnClick(nil);
  124. end;
  125. end.
  126.  
  127. Link to download the project complete :http://fit.sh/gCe
  128. Note: Skip the annonce To be able to download
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement