For enter passwords


/ Published in: Delphi
Save to your folder(s)

This program make input type for password.


Copy this code and paste it in your HTML
  1. unit Unit1;
  2.  
  3. interface
  4.  
  5. uses
  6. Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  7. Dialogs, StdCtrls;
  8.  
  9. type
  10. TForm1 = class(TForm)
  11. Edit1: TEdit;
  12. procedure Edit1KeyPress(Sender: TObject; var Key: Char);
  13. procedure Edit1KeyUp(Sender: TObject; var Key: Word;
  14. Shift: TShiftState);
  15. private
  16. { Private declarations }
  17. public
  18. { Public declarations }
  19. end;
  20.  
  21. var
  22. Form1: TForm1;
  23. q : string; //str of *
  24. w : string; //real str
  25. e : longint;
  26.  
  27. implementation
  28.  
  29. {$R *.dfm}
  30.  
  31. procedure TForm1.Edit1KeyPress(Sender: TObject; var Key: Char);
  32. begin
  33. if Key = #27 then begin
  34. AssignFile(output, 'output.txt'); rewrite(output);
  35. writeln(output,w);
  36. CloseFile(output);
  37. end;
  38. if Key = #8 then begin
  39. if length(w) > 0 then begin
  40. SetLength(q,(length(q)-1));
  41. SetLength(w,(Length(w)-1));
  42. Edit1.Text := q;
  43. end;
  44. end
  45. else begin
  46. q := q + '*';
  47. Edit1.Text := q;
  48. e := Length(w) + 1;
  49. SetLength(w,e);
  50. w[e] := Char(Key);
  51. end;
  52. end;
  53.  
  54. procedure TForm1.Edit1KeyUp(Sender: TObject; var Key: Word;
  55. Shift: TShiftState);
  56. begin
  57. Edit1.Text := q;
  58. end;
  59.  
  60. end.

URL: www.sa1t.ru

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.