طريقة اغلاق البرنامج (او القيام بأي إجراء ) بعد عدد من المحاولات
#2
كمثال بسيط اضف عداد في الـ TForm وليكن FTryCount وعند محاولة إدخال كود يتم زيادة هذا العداد بالامر Inc

مثال تطبيقي :
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. 
طبعاً مثل هذه الخدعه تعتبر دعابة عند الكراكرز :p
نلتقي لنرتقي
الرد


الردود في هذا الموضوع
طريقة اغلاق البرنامج (او القيام بأي إجراء ) بعد عدد من المحاولات - بواسطة ALmuhhnad - 26-10-2014, 10:25 PM

التنقل السريع :


يقوم بقرائة الموضوع: بالاضافة الى ( 1 ) ضيف كريم