Formulář, který se otevře před otevřením samotné aplikace. unit main;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TMainForm = class(TForm)
Label1: TLabel;
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
MainForm: TMainForm;
implementation
uses login;
{$R *.dfm}
procedure TMainForm.Button1Click(Sender: TObject);
begin
if TLoginForm.Execute then
begin
Application.MessageBox(””””””””””””””””OK jste přihlašení””””””””””””””””, ””””””””””””””””Password Protected Delphi application””””””””””””””””);
end
else
begin
Application.MessageBox(””””””””””””””””You are not authorized to use the application. The password is “delphi”.””””””””””””””””, ””””””””””””””””Password Protected Delphi application””””””””””””””””);
Close;
end;
end;
end.
procedure TLoginForm.LogInButtonClick(Sender: TObject);
begin
if passwordEdit.Text = ””””””””””””””””delphi”””””””””””””””” then
ModalResult := mrOK
else
ModalResult := mrAbort;
end;
class function TLoginForm.Execute: boolean;
begin
with TLoginForm.Create(nil) do
try
Result := ShowModal = mrOk;
finally
Free;
end;
end;
procedure TLoginForm.FormCreate(Sender: TObject);
begin
passwordEdit.Text := ””””””””””””””””””””””””””””””””;
end;