I need to make simple time trial app.


So how can it be done.

Read registration date?
Read actual date?

If  actual date - registration date > 30 then .......  ?

And is posible to check if bios time was changed in last 30 days?
pr2501Asked:
Who is Participating?
 
Ephraim WangoyaCommented:

Here is an example of how to implement time trial

Unit1.dfm
Unit1.pas
CheckTrial.dfm
CheckTrial.pas
0
 
jimyXCommented:
Did you try the mxProtector demo "TimeTrail"?
I am sure it does that exactly.
0
 
pr2501Author Commented:
Which procedures from  mxProtector demo ?
0
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
jimyXCommented:
Set the mxProtector properties:
Expiration = the expiration date
Options:
  poAutoInit=True
  poCheckSystemTime=True
Protection Types:
  stTimeTrail = True

And the events:
OnExpiration:
OnTimeTrail:
OnInvalidSystemTime:
Procedure TForm1.mxProtectorExpiration( Sender: TObject );
Begin
  showmessage('This licence has expired');
  // disable all the controls here
End;

Procedure TForm1.mxProtectorTimeTrial( Sender: TObject; DaysRemained: Integer );
Begin
  if DaysRemained < mxProtector.GetLicencedDayNumber then
    begin
      showmessage('still have '+ inttostr(DaysRemained) +' days');
      // enable all the controls
    end
  else
    begin
      showmessage('System will lock up, the time trail is over!');
      // disable all the controls
    end;
  ;
End;

Procedure TForm1.mxProtectorInvalidSystemTime( Sender: TObject );
Begin
     MessageDlg('Your system time is invalid.' + #13 + #10 + 'Please set the correct date and time to continue.', mtError, [ mbOK ], 0 );
End;

Open in new window

0
 
jimyXCommented:
Here is a sample application, just adjust the time "Expiration" and test it, also try to change the system time and test it again.

>   "And is possible to check if bios time was changed in last 30 days?"
No, it is not possible unless your program keeps tracking it. For instance when your application is launched the first time, it will capture the bios time and store in the the registry or DB and whenever your application is launched again then it matches between the stored time and the current time and hence you detect any differences. Other than that you can't detect if it has changed.

PS: this is the simplest that it can be. So it can be improved more. But for the basic idea this will do.
mxProtector.zip
0
 
pr2501Author Commented:
In factory office i have sytem download prohibition for  zip files so i could not use
jimyX code.

Hi Ewagnowa, what else must i set to make it work because now i have mesage :
This licence was expired: 0 day remaining.
0
 
jimyXCommented:
Extracted and reattached.
Project1.dpr
Unit1.dfm
Unit1.pas
0
 
pr2501Author Commented:
JimyX. Your code is doing fine.
A hope Ewangow will clear  settings: Expiration  and MaxDayNumber
to make it work fine too.
I am satisfied as we proceed. I hope You agree.
I will be out this weekend from tomorrow.
0
 
pr2501Author Commented:
Hi Ewangowa

What is wrong with setings to get next result?
norun.JPG
run.JPG
0
 
Ephraim WangoyaCommented:

I dont have my workstation with mxProtector right now, there is a method if I remember in mxProtector called Reset, which is supposed to reset all the values and restart the time trial.
0
 
Ephraim WangoyaCommented:


You can change the MaxDayNumber to whatever value you want.
I added the reset button just for test, this will restart the trial
CheckTrial.dfm
CheckTrial.pas
0
 
pr2501Author Commented:
OK. Does it mean
that expiration parameter do not have any sense.
(i can write any value in it - it does not make any difference, and if i live it blank
, with new restart of project, data of 5/7/2011 8:32:23 AM is set automatically)
0
 
Ephraim WangoyaCommented:

That expiration date does nothing it time trial, and it can not be changed at runtime either.
You can even set it to last year and the program will still functions.
The important property is the MaxDayNumber
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.