Processed files:

  1. EnigmaEx.dpr   —   195 bytes
  2. Main.pas   —   1.54 KB
  3. Main.dfm   —   2.10 KB

File 1: EnigmaEx.dpr
File size: 195 bytes

program EnigmaEx;

uses
  Forms,
  Main in 'Main.pas' {FormMain};

{$R *.res}

begin
  Application.Initialize;
  Application.CreateForm(TFormMain, FormMain);
  Application.Run;
end.



File 2: Main.pas
File size: 1.54 KB

unit Main;

interface


uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, ActnList, StdCtrls, ComCtrls, Clipbrd;

type
  TFormMain = class(TForm)
    Label1: TLabel;
    edPass: TEdit;
    Button1: TButton;
    ActionList1: TActionList;
    actEsc: TAction;
    actGenerate: TAction;
    edChars: TEdit;
    Label2: TLabel;
    udChars: TUpDown;
    chAutoCopy: TCheckBox;
    procedure FormCreate(Sender: TObject);
    procedure actEscExecute(Sender: TObject);
    procedure actGenerateExecute(Sender: TObject);
  end;


const
  AppName = 'EnigmaEx 1.0';
  LEN_MIN = 4;
  LEN_MAX = 40;
  LEN_DEF = 10;
  
  
var
  FormMain: TFormMain;


implementation


{$R *.dfm}


procedure TFormMain.FormCreate(Sender: TObject);
begin
  Caption := AppName;
  Application.Title := AppName;

  udChars.Min := LEN_MIN;
  udChars.Max := LEN_MAX;
  udChars.Position := LEN_DEF;
  
  edPass.Text := '';
  actGenerate.Execute;
end;




procedure TFormMain.actEscExecute(Sender: TObject);
begin
  Close;
end;



procedure TFormMain.actGenerateExecute(Sender: TObject);
var
  i: integer;
  xb: Byte;
  s: string;

  function GetChar: Char;
  begin
    repeat
      xb := Random(123);
    until (xb in [48..57]) or (xb in [65..90]) or (xb in [97..122]);
    Result := Char(xb);
  end;

begin
  s := '';
  Randomize;

  for i := 1 to udChars.Position do s := s + GetChar;

  edPass.Text := s;

  if chAutoCopy.Checked then Clipboard.AsText := s;

end;


end.



File 3: Main.dfm
File size: 2.10 KB

object FormMain: TFormMain
  Left = 463
  Top = 260
  BorderStyle = bsDialog
  Caption = 'FormMain'
  ClientHeight = 154
  ClientWidth = 365
  Color = clBtnFace
  Font.Charset = DEFAULT_CHARSET
  Font.Color = clWindowText
  Font.Height = -11
  Font.Name = 'MS Sans Serif'
  Font.Style = []
  OldCreateOrder = False
  Position = poScreenCenter
  OnCreate = FormCreate
  DesignSize = (
    365
    154)
  PixelsPerInch = 96
  TextHeight = 13
  object Label1: TLabel
    Left = 8
    Top = 8
    Width = 35
    Height = 13
    Caption = 'Has'#322'o :'
  end
  object Label2: TLabel
    Left = 8
    Top = 60
    Width = 77
    Height = 13
    Caption = 'Liczba znak'#243'w :'
  end
  object edPass: TEdit
    Left = 6
    Top = 24
    Width = 353
    Height = 24
    Anchors = [akLeft, akTop, akRight]
    Font.Charset = DEFAULT_CHARSET
    Font.Color = clWindowText
    Font.Height = -13
    Font.Name = 'Verdana'
    Font.Style = []
    ParentFont = False
    TabOrder = 0
    Text = 'edPass'
  end
  object Button1: TButton
    Left = 126
    Top = 120
    Width = 113
    Height = 25
    Action = actGenerate
    Font.Charset = DEFAULT_CHARSET
    Font.Color = clWindowText
    Font.Height = -12
    Font.Name = 'Tahoma'
    Font.Style = [fsBold]
    ParentFont = False
    TabOrder = 1
  end
  object edChars: TEdit
    Left = 92
    Top = 56
    Width = 41
    Height = 21
    TabOrder = 2
    Text = '0'
  end
  object udChars: TUpDown
    Left = 133
    Top = 56
    Width = 10
    Height = 21
    Associate = edChars
    TabOrder = 3
  end
  object chAutoCopy: TCheckBox
    Left = 16
    Top = 88
    Width = 257
    Height = 17
    Caption = 'Po wygenerowaniu has'#322'a kopiuj je do Schowka'
    TabOrder = 4
  end
  object ActionList1: TActionList
    Left = 192
    Top = 65528
    object actEsc: TAction
      Caption = 'actEsc'
      ShortCut = 27
      OnExecute = actEscExecute
    end
    object actGenerate: TAction
      Caption = 'Generuj has'#322'o'
      ShortCut = 13
      OnExecute = actGenerateExecute
    end
  end
end