Project PAT_p.exe raised exception class EAccessViolation with message 'Access violation at address 0049E197 in module 'PAT_p.exe'. Read of address 00000000'. Process stopped. Use step or run to continue.
- Code: Select all
unit Welcome_u;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, jpeg, ExtCtrls, Login_u;
type
TWelcome = class(TForm)
imgABC: TImage;
btnBegin: TButton;
lblWelcome: TLabel;
procedure btnBeginClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Welcome: TWelcome;
implementation
{$R *.dfm}
procedure TWelcome.btnBeginClick(Sender: TObject);
begin
Welcome.Hide;
Login.ShowModal;
end;
end.
unit Login_u;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, DMUsers, Game_u;
type
TLogin = class(TForm)
lblLogin: TLabel;
lblUsername: TLabel;
lblPassword: TLabel;
edtUsername: TEdit;
edtPassword: TEdit;
btnLogin: TButton;
lblRegister: TLabel;
btnRegisterDirect: TButton;
procedure btnRegisterDirectClick(Sender: TObject);
procedure btnLoginClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Login: TLogin;
implementation
uses Register_u, ADODB;
{$R *.dfm}
procedure TLogin.btnRegisterDirectClick(Sender: TObject);
begin
Login.Hide;
Login.Close;
Register.ShowModal;
end;
procedure TLogin.btnLoginClick(Sender: TObject);
var
Result,PasswordResult:Boolean;
begin
Result := False;
begin
if edtPassword.GetTextLen=0 then
begin
ShowMessage('Please enter a password');
Game.ShowModal
end;
if edtUsername.GetTextLen=0 then
begin
ShowMessage('Please enter a password');
end;
Result:= DataModule1.tblUsers.Locate('UserName', edtUsername.Text,[]);
if Result=True then
begin
PasswordResult:=false;
PasswordResult:=DataModule1.tblUsers.Locate('Password', edtPassword.Text, []);
end;
if Result=false then
begin
ShowMessage('You are not registered');
end;
if Result=true then
begin
if PasswordResult=true then
begin
Login.Hide;
ShowMessage('Login successful');
Game.ShowModal;
end
else
begin
ShowMessage('Incorrect username or password');
end;
end;
end;
end;
end.
unit Game_u;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls;
type
TGame = class(TForm)
edtWord: TEdit;
btnNext: TButton;
imgTest: TImage;
lblPicture: TLabel;
private
{ Private declarations }
public
{ Public declarations }
end;
var
Game: TGame;
implementation
{$R *.dfm}
end.