Topic: [Script] Create trial project

It allows you to make your project work with a limited period, such as 30 days.


Also giving the client a program for testing, you can delete the file from the folder Script.pas Script, to the script could not be modified.


procedure Form1_OnShow (Sender: string; Action: string);
var
   reg: TRegistry;
   iDays: integer;
begin
     reg := TRegistry.Create;
     reg.Access := KEY_ALL_ACCESS;
     reg.RootKey := HKEY_CURRENT_USER;
     reg.OpenKey('software\MyVisualDatabaseTrial',true);
     if not reg.ValueExists('StartDate') then reg.WriteDate('StartDate', Now+30); // trial period is 30 days

     iDays := Trunc(reg.ReadDate('StartDate')) - Trunc(Now); // time left days

     reg.CloseKey;
     reg.Free;

     if iDays < 1 then
     begin
          if MessageDlg('Trial period is over.'+#13+' Do you want to visit a order page?', mtInformation, mbYes+mbNo, 0) = mrYes
              then OpenUrl('http://yourpage.com');

          Form1.Close;
          Exit;
     end;

     if MessageDlg('Demo version. Time left: ' + IntToStr(iDays) +' days.'+#13+'Do you want to visit a order page?', mtInformation, mbYes+mbNo, 0) = mrYes
         then OpenUrl('http://yourpage.com');

end;

begin
end.

Download project:
http://myvisualdatabase.com/forum/misc. … download=1


Another project with serial number:
http://myvisualdatabase.com/forum/misc. … download=1

Post's attachments

Attachment icon Trial and Serial.zip 5.87 kb, 2457 downloads since 2015-10-05 

Dmitry.

Re: [Script] Create trial project

How to make specific key for specific time...
for example 120 day,180 day ,777 day ,life time etc

JUST LEARNING, O GOD HELP ME.

Re: [Script] Create trial project

Serials for duration base, please visit the topic.
http://myvisualdatabase.com/forum/viewtopic.php?id=3124

JUST LEARNING, O GOD HELP ME.

Re: [Script] Create trial project

Hi Drivesoft,

I tried this one above in one of my projects and it works, but after 30 days, when the user closes the 'Demo Form' the user can still use the application and the Demo Form just displays 'your trial is over'.

How to make it that after 30 days, the application cannot be opened (or users will be directed to a website) unless they type-in a license key?

Anyone?

Thanks!

Anakin

---may the force be with you!

Re: [Script] Create trial project

Hello Anakin

Try this snippet : After 30 days trial, it will shows a nag screen

procedure Form1_OnShow (Sender: string; Action: string);
var   reg: TRegistry;
       iDays: integer;
      sKey: string;
begin
     sKey := '';
     reg := TRegistry.Create;
     reg.Access := KEY_ALL_ACCESS;
     reg.RootKey := HKEY_CURRENT_USER;
     reg.OpenKey('software\'+APP_NAME,true);
     if not reg.ValueExists('StartDate') then reg.WriteDate('StartDate', Now+30); // trial period is 30 days

     iDays := Trunc(reg.ReadDate('StartDate')) - Trunc(Now); // time left days
     sKey := reg.ReadString('Key');

     reg.CloseKey;
     reg.Free;

     if sKey<>'' then
     begin
         if CheckKey(sKey) then Exit;
     end;

     if iDays < 1 then
     begin
          frmNagScreen.lbTrial.Caption := 'Trial period is over.';
          frmNagScreen.ShowModal;
          Exit;
     end;

     isAllowRun := True;
     frmNagScreen.lbTrial.Caption := 'Demo version. Time left: ' + IntToStr(iDays) +' days.';
     frmNagScreen.ShowModal;

end;


procedure frmNagScreen_bOrderPage_OnClick (Sender: string; var Cancel: boolean);
begin
    OpenUrl('http://yourpage.com');
end;

function CheckKey(sKey: string): boolean;
begin
    Result := False;
    if (sKey='FJKS-TJKS-WEEW-NMVV') or
       (sKey='NNMF-QPOV-FDDK-ZUIF') or
       (sKey='VCJK-RGJJ-CWER-GHFJ') then Result := True;
end;


begin

end.


Hope this can help you
JB

Re: [Script] Create trial project

jean.brezhonek,

thank you, will try this out!

Anakin

---may the force be with you!