⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mainfrm.pas

📁 一个老外 的程序,看上还可以,值得借鉴.拿出来和大家分享
💻 PAS
字号:
unit mainFrm;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, ComObj;

type
  TForm1 = class(TForm)
    Memo1: TMemo;
    ButtonStart: TButton;
    procedure ButtonStartClick(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
      lic: OleVariant;
      function protectMe: Boolean;
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

function TForm1.protectMe: Boolean;
var
   iRes:          Integer;
   sTag:          WideString;
   sReadKey:      WideString;
   sReturncode:   String;
begin
	iRes := 0;
	sTag := '';
	sReadKey := 'r1lkYAp1xGQN81fBrcZ1dfXtw1doy3Z1l4KHy0N2yvL0ZBDcX274DHV1BfV7s0'
      + 'RFpjZ1NOmMf1qXGsu1MqTXK1t4Tsq1c7jQq1iP3VM1NNx6j1s64YK299TY71YSrbK0NdSo'
      + 'm29inxM29bPTJ1mmLNV0SNdC41xCbdT2adSqt2aazQL1dslWy1fGXFi11YWOv1fFhLt2ac'
      + 'ufE1hRGXY1VxH0R0ViybX0XmcNz1lm76W1gQqQe21grLU1VAc401UqH8l0YHwOD1S46cC20hVpD1cfAYk299ixt';
   result := true;

	// the example needs the licence file: demo-easygo.lic

   // Important: If you have another version of Licence Protector please adapt
   //          the ProgID in the following CreateOleObject call
   try
      lic := CreateOleObject('LicenceProtector.LicProtectorEasyGo243');
   except
      on E: Exception do
      begin
         ShowMessage('No or wrong LicenceProtector installed: ' + E.Message);
         result := false;
      end;
   end;

   if result then
   begin
      try
         lic.SecurityLevel := 1;// use 1 for Security Level ADVANCED (needs a ReadKey) or 0 for Security Level BASIC

         // Language-Codes:
         //   10000   German
         //   20000   English
         //   30000   French
         //   40000   Italian
         // For all supported Languages read the Developer Documentation.
         lic.SetLanguage(20000);

   		lic.SetRegisterHelp( '',
		   		'',
	   			'',
			   	'',
   				'',
	   			'',
		   		'');

   		lic.SetRegisterSettings('cdc.jpg',		// Image that is displayed in the Registration form (has to be of format JPEG)
	   			true,           // allow LicenceViewer (recommended to TRUE)
		   		true,           // Serial is an Activation Key, always use TRUE!
			   	'Mirage Computer Systems', // Name of the manufacturer
				   'CTI Data Connector',      // Name of the product
   				true,           // use Online-Activation? recommended TRUE but needs Web Activation Service
	   			true,           // Activation by e-mail?
		   		'register@registerserver.net', // e-mail-address for activation requests
			   	true,			// Activation by fax?
   				'+49 721/15159963', // Fax-Number for incoming Activation requests
	   			true,           // Activation by phone?
		   		'+49 700 54885342', // phone number for activation requests
   				'Your registration information is sent to our Activation Center. Please allow 1 to 2 business days to send an unlock key.',
	   			// additional text for e-mail and fax, may be empty
		   		0,				// Default Registration 0 = online, 1 = eMail, 2 = fax, 3 = phone
			   	'www.mirage-systems.de/cdc/order.html',     // URL for buying the product
				   'www.mirage-systems.de/cdc/activation-guide.html',      // URL for online help
   				'V3DEq-5CP93-9E4Ik-3tJ8X-lQD5k-6c14X',
	   			// Copy Protection Switch On Key - please check documentation
		   		'');			// Copy Protection Switch Off Key - please check documentation

   		iRes := lic.PrepareAndCheck('demo-easygo.lic', sReadKey, 'QHD001', '', true, false, sTag);

	   	if (iRes <> 0) then
         begin
            result := false;
		   end;

   	except
         on E: Exception do
         begin
            ShowMessage('Error validating licence: ' + E.Message);
            result := false;
         end;
      end;
      sReturncode := 'Returncode: ' + IntToStr(iRes) + '. ' + lic.GetErrorMessage(iRes);
	   lic.Quit;
   	ShowMessage(sReturncode);
   end;
end;



procedure TForm1.ButtonStartClick(Sender: TObject);
begin
   // Check the copy protection of this application
   // If the result is FALSE the licence file is not valide
   if not self.protectMe then
   begin
      Application.Terminate;
   end;

end;

end.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -