26-10-2014, 08:31 PM
26-10-2014, 10:25 PM
كمثال بسيط اضف عداد في الـ TForm وليكن FTryCount وعند محاولة إدخال كود يتم زيادة هذا العداد بالامر Inc
مثال تطبيقي :
طبعاً مثل هذه الخدعه تعتبر دعابة عند الكراكرز :p
مثال تطبيقي :
PHP كود :
unit Unit1;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls;
type
TForm1 = class(TForm)
btnRegistration: TButton;
procedure btnRegistrationClick(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
FTryCount: Byte;// Byte is 0..255
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.btnRegistrationClick(Sender: TObject);
begin
if Key = MyOriginalKey then // right key
begin
end
else // wrong key
begin
Inc(FTryCount);
if FTryCount = 3 then Application.Terminate; // check if the user try three times then close then application
end;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
FTryCount := 0; // set FTryCount to 0
end;
end.
27-10-2014, 08:14 AM
اهلا اخي لم افهم جيدا المثال هذا هو الكود سورس الذي استعمل
كود :
procedure TForm1.Boutton1Click(Sender: TObject);
begin
if ((edit1.text='farid') and(edit2.text='ts')) or ((edit1.text='hssen') and(edit2.text='t')) or ((edit1.text='foudi') and(edit2.text='tss'))
then
begin
form2.show;
form1.Hide ; end
else
showmessage('erreur mot de passe')
end ;27-10-2014, 09:40 AM
hadi91 كتب :اهلا اخي لم افهم جيدا المثال هذا هو الكود سورس الذي استعملالسلام عليكمكود :procedure TForm1.Boutton1Click(Sender: TObject); begin if ((edit1.text='farid') and(edit2.text='ts')) or ((edit1.text='hssen') and(edit2.text='t')) or ((edit1.text='foudi') and(edit2.text='tss')) then begin form2.show; form1.Hide ; end else showmessage('erreur mot de passe') end ;
بتطبيق ما قاله الاخ ALmuhhnad على مثالك يصبح هكدا
كود :
unit Unit1;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls;
type
TForm1 = class(TForm)
btnRegistration: TButton;
procedure btnRegistrationClick(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
FTryCount: Byte;// Byte is 0..255
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.btnRegistrationClick(Sender: TObject);
begin
if ((edit1.text='farid') and(edit2.text='ts')) or ((edit1.text='hssen') and(edit2.text='t')) or ((edit1.text='foudi') and(edit2.text='tss'))
then
begin
form2.show;
form1.Hide ;
end
else // wrong key
begin
showmessage('erreur mot de passe') ;
Inc(FTryCount);
if FTryCount = 3 then Application.Terminate; // check if the user try three times then close then application
end;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
FTryCount := 0; // set FTryCount to 0
end;
end.