Hello toutheveste
Can this help you ?
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.
Obviously, if you change your system date (for example if you advance it by two days), the parameter passed in StartDate will be false and the value returned by reg.WriteDate ('StartDate', Now + 30); will prevent this code from working.
In addition I do not see the interest for a user to constantly make this maneuver to avoid the message displayed by this code (and not to pay a license).
JB