CheckCode method
function TOgCodeBase.CheckCode(Report : Boolean) : TCodeStatus; virtual; abstract;
TCodeStatus = (ogValidCode, ogInvalidCode, ogPastEndDate, ogDayCountUsed, ogRunCountUsed, ogNetCountUsed, ogCodeExpired);

TurboPack OnGuard FMX

CheckCode method

function TOgCodeBase.CheckCode(Report : Boolean) : TCodeStatus; virtual; abstract;

TCodeStatus = (ogValidCode, ogInvalidCode, ogPastEndDate, ogDayCountUsed, ogRunCountUsed, ogNetCountUsed, ogCodeExpired);

Navigation:  »No topics above this level«

CheckCode method

function TOgCodeBase.CheckCode(Report : Boolean) : TCodeStatus; virtual; abstract;

TCodeStatus = (ogValidCode, ogInvalidCode, ogPastEndDate, ogDayCountUsed, ogRunCountUsed, ogNetCountUsed, ogCodeExpired);

Return to chapter overview

_bm1                CheckCode checks for a valid release code.

CheckCode is defined as virtual and abstract, which means that each descendant component overrides it to provide the necessary code to validate and test the release code obtained through the Code property. If Report is True, the result of the test is reported by triggering the OnChecked event. If Report is False, you must check the function result.

CheckCode requires several pieces of information, which it obtains by triggering event handlers that you define. The normal sequence of events performed by CheckCode is:

1.                Trigger the OnGetKey event to get the key used to encode and decode the release code. The key should always be embedded in the application as a constant.

2.                Trigger the OnGetCode event to get the release code. The release code is normally stored in the registry or an INI file.

3.                Trigger the OnGetModifier event to get the key modifier. The modifier can be stored as a constant in the application, stored in the registry or INI file, or generated when it is needed.

4.                Apply the modifier to the key.

5.                Test the release code to see if it is valid.

6.                Test the release code to see if it has expired. The details of this test depend on the type of release code.

The result of calling CheckCode is one of the following values:

ogValidCode

 release code is valid.

ogInvalidCode

 release code is invalid (the internal integrity check failed).

ogPastEndDate

 ending date has past.

ogDayCountUsed

 authorized days have been used.

ogRunCountUsed

 authorized runs have been used.

ogNetCountUsed

 number of authorized users has been exceeded.

ogCodeExpired

 The expiration date has been reached.

See also: AutoCheck, OnChecked, OnGetCode, OnGetKey, OnGetModifier