pr2501
asked on
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?
ASKER
Which procedures from mxProtector demo ?
Set the mxProtector properties:
Expiration = the expiration date
Options:
poAutoInit=True
poCheckSystemTime=True
Protection Types:
stTimeTrail = True
And the events:
OnExpiration:
OnTimeTrail:
OnInvalidSystemTime:
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;
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
> "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
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
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.
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.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
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.
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.
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.
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
ASKER
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)
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)
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
I am sure it does that exactly.