Description

Function will set license validity period.

Availability

Protection method:
REMOTE
Application status: Activated
Required features: Limited license feature

Declaration

Visual C/C++
extern "C" __declspec(dllimport) int __stdcall SetLicenseValidityPeriod(int Period);
Visual Basic
Declare Function SetLicenseValidityPeriod Lib "pcgint.dll" Alias "_SetLicenseValidityPeriod@4" (ByVal Period As Long) As Long
Delphi
function SetLicenseValidityPeriod( Period: longint): longint; stdcall; external 'pcgint.dll' name '_SetLicenseValidityPeriod@4';
Delphi 64bit
function SetLicenseValidityPeriod( Period: longint): Int64; stdcall; external 'pcgint64.dll';

Parameters

Period - New license validity period in days (1-9999)

Return values

If the function succeeds, PCGI_STATUS_OK is returned and new license validity period is set.

If the function fails, return value is on of the following error codes:

PCGI_ERROR_LIMITED_LICENSE_DISABLED
PCGI_ERROR_APPLICATION_IS_LOCKED
PCGI_ERROR_INVALID_VALIDITY_PERIOD
PCGI_CRITICAL_ERROR

Full list of return codes is available here.

Notes

- Use this function to change current license validity period and extend license for a variable period of time (in days) without using ExtendLicense function.

- Please note that fixed date expiration or number of runs limitation for limited license will still remain active and could supersede primary limitation (license validity period). In this way license could expire even if you increase license validity period.

- Example scenario:

Default license validity period is set to 30 days in project settings. 

By default, this default license validity period is initialized after activation of protected application on remote computer.

  Day 0 Day 1 Day 2 ... Day 10
PCGI_LimitedLicenseDaysLeft 30 29 28 ... 20

As you can see at Day 10 there are 20 days left. Current license validity period is 30 days.

You would use SetLicenseValidityPeriod() to replace current validity period.

On Day 10 calling:
 
SetLicenseValidityPeriod(30) would change nothing. 

SetLicenseValidityPeriod(40) would actually extend license for another 10 days.  PCGI_LimitedLicenseDaysLeft would be 30 days after this call.

SetLicenseValidityPeriod(80) would actually extend license for another 50 days.  PCGI_LimitedLicenseDaysLeft would be 70 days after this call.

Here is another example... 

You can use this function to replace default license validity period accordingly to custom features and custom counters where each feature would represent appropriate custom counter with license validity period.

For example, Feature 1 would represent Counter 1, Feature 2 would represent counter 2 and so on. Each counter would hold appropriate number of days. For example, Counter 1 would be set to 30 days, Counter 2 would be set to 60 days and so on up to the last Counter 10.

Protected application would be able to obtain feature status after activation and then use appropriate counter value for a call to SetLicenseValidityPeriod function.