Foundation 6

Fnd_Reg

32 shared methods.

Fnd_Reg_Alert

Fnd_Reg_Alert (message)

Displays an alert message. Uses the Foundation Dialog module alert if available.

ParameterTypeDirectionDescription
messageTextinThe alert message text

Fnd_Reg_BuyNowButton

Fnd_Reg_BuyNowButton

Gets called from the Buy Now buttons.

No parameters.

Fnd_Reg_BuyNowURL

Fnd_Reg_BuyNowURL ({feature code{; URL}}) --> Text

Allows the developer to get and set the URL to go to if the Buy Now button is clicked.

ParameterTypeDirectionDescription
inFeatureCodeTextinA feaure code (optional)
inUrlTextinThe URL (optional)
ResultTextoutThe URL

Fnd_Reg_CreateTable

Fnd_Reg_CreateTable --> Object

Creates the [Fnd_Reg] table the Registration component needs, in an interpreted host. Fnd_Reg_Init offers to call it; a developer can also call it directly. If the table already exists, nothing is changed.

The table it creates: ID               Longint, primary key Feature_Code     Alpha 80 (Fnd_Reg_Init indexes it) Demo_Days        Integer Demo_Start_Date  Date Unlock_Code      Alpha 40 User_Name        Alpha 80 License_Info     Alpha 80 Checksum         Alpha 40

In a compiled host, or on a remote client, it changes nothing and returns success False with a message. After it creates the table, restart the host before using Fnd_Reg.

ParameterTypeDirectionDescription
ResultObjectout{ success : Boolean ; created : Boolean ; restartRequired : Boolean ; message : Text }

Fnd_Reg_DemoDays

Fnd_Reg_DemoDays ({feature code{; days}}) --> Number

Allows the developer to set and get the number of demo days for the specified feature.

This routine does not modify the expiration date if it has already been set.

ParameterTypeDirectionDescription
inFeatureCodeTextinFeature code (optional)
inDaysLongintinThe number of days (optional)
ResultLongintoutThe number of days

Fnd_Reg_DemoDialog

Fnd_Reg_DemoDialog ({feature code})

Displays the demo dialog if the feature is not registered.

ParameterTypeDirectionDescription
inFeatureCodeTextinFeature code (optional)

Fnd_Reg_DemoDialogFormMethod

Fnd_Reg_DemoDialogFormMethod

We call this from a protected method because a public form can't call private methods.

No parameters.

Fnd_Reg_DemoMessage

Fnd_Reg_DemoMessage ({feature code{; message}}) --> Text

Sets and gets the demo message for the specified feature code.

This text is displayed in the demo dialog.

This text can be localized, so it's not stored in the with the registration record. If you want to use something other than the default values, you'll need to call this method to set up the names before trying to retrieve them or before displaying the registration dialogs.

Pass an empty string to revert to the default message (from the localization strings).

ParameterTypeDirectionDescription
inFeatureCodeTextinThe feature code (optional)
inMessageTextinThe new demo message (optional)
ResultTextoutThe current demo message

Fnd_Reg_FeatureCodeIndex

Fnd_Reg_FeatureCodeIndex (feature code) --> Number

Returns the index in the arrays for the specified feature code. If the feature code hasn't been added to the arrays yet it is created.

ParameterTypeDirectionDescription
featureCodeTextinA feature code
ResultLongintoutThe index in the arrays

Fnd_Reg_FeatureName

Fnd_Reg_FeatureName ({feature code{; feature name}}) --> Text

Sets and gets the feature name for the specified feature code.

This name is used in the registration dialogs.

These names can be localized, so they're not stored in the with the registration information. If you want to use something other than the default values, you'll need to call this method to set up the names before trying to retrieve them or before displaying the registration dialogs.

The Application code returns the database name.

Other feature codes return "Feature: codename"

ParameterTypeDirectionDescription
inFeatureCodeTextinThe feature code (optional)
inFeatureNameTextinThe new feature name (optional)
ResultTextoutThe current feature name

Fnd_Reg_Format

Fnd_Reg_Format (MD5; format) --> Text

Returns an unlock code by formatting the MD5 value using the specified format.

The # characters in the format string are replaced by characters from the MD5.

Example: Input: ("35bf6fd6b73c1e29ac15a50316c4cc6c";"Test ###-##/###*") Output: "Test 35b-f6/fd6*"

ParameterTypeDirectionDescription
md5TextinAn MD5 value
inFormatTextinA format description
ResultTextoutThe formatted value

Fnd_Reg_GetDemoDaysRemaining

Fnd_Reg_GetDemoDaysRemaining ({feature code}) --> Number

Returns the number of days left in the demo. Calculated by adding the number of demo days to the demo start date.

If the demo hasn't been started, the number of demo days is returned.

ParameterTypeDirectionDescription
inFeatureCodeTextinThe feature code (optional)
ResultLongintoutDays remaining

Fnd_Reg_GetExpirationDate

Fnd_Reg_GetExpirationDate ({feature code}) --> Date

Gets the feature's expiration date. This is calculated by adding the number of demo days to the date the demo period was started.

If the demo hasn't been started, the number of demo days is added to the current date, and the resulting date is returned.

ParameterTypeDirectionDescription
inFeatureCodeTextinThe feature code (optional)
ResultDateoutThe expiration date

Fnd_Reg_GetLicenseInfo

Fnd_Reg_GetLicenseInfo ({feature code}) --> Text

Returns the name of the registered user. Returns an empty string if the program hasn't been registered yet.

ParameterTypeDirectionDescription
inFeatureCodeTextinThe feature code (optional)
ResultTextoutThe name of the registered user

Fnd_Reg_GetUnlockCode

Fnd_Reg_GetUnlockCode ({feature code}) --> Text

Returns the unlock code that's been entered into the data file. Returns an empty string if the program hasn't been registered yet.

ParameterTypeDirectionDescription
inFeatureCodeTextinThe name of the feature in question (optional)
ResultTextoutThe feature's unlock code

Fnd_Reg_GetUserName

Fnd_Reg_GetUserName ({feature code}) --> Text

Returns the user name that has been saved in the registration record (if any).

ParameterTypeDirectionDescription
inFeatureCodeTextinFeature name (optional)
ResultTextoutThe registered user's name

Fnd_Reg_Info

Fnd_Reg_Info (label) --> Text

Returns requested information. See the Fnd_Gen_ComponentInfo method for more information.

Fnd_Reg licenses the host developer's application, not Foundation: it shows the host's demo and registration dialogs and checks the unlock codes the host issues.

Fnd_Reg needs a [Fnd_Reg] table in the host: ID Longint, Feature_Code Alpha 80, Demo_Days Integer, Demo_Start_Date Date, Unlock_Code Alpha 40, User_Name Alpha 80, License_Info Alpha 80 and Checksum Alpha 40. Fnd_Reg_Init offers to create it with Fnd_Reg_CreateTable.

ParameterTypeDirectionDescription
requestTextinInfo desired ("version" or "name")
ResultTextoutResponse

Fnd_Reg_LoadRegistrationRecord

Fnd_Reg_LoadRegistrationRecord ({feature code})

Searches for the registration record for the specified feature. If one is found, it is checked to make sure it hasn't been tampered with.

ParameterTypeDirectionDescription
inFeatureCodeTextinThe feature code (optional)

Fnd_Reg_Localize

Fnd_Reg_Localize

Passed the localization strings to the General and (if available) Localization components.

No parameters.

Fnd_Reg_RegDialogFormMethod

Fnd_Reg_RegDialogFormMethod

We call this from a protected method because a public form can't call private methods.

No parameters.

Fnd_Reg_RegDialogOKButton

Fnd_Reg_RegDialogOKButton

We call this from a protected method because a public form can't call private methods.

No parameters.

Fnd_Reg_Register

Fnd_Reg_Register (feature code; unlock code; user name)

Call to register the product. Sets the OK variable to 1 if the product gets registered. Sets the Error variable if there's a problem.

This doesn't check to see if it's already been registered, so it can be called to change the registration at any time. But only does the update if the user name and unlock code are valid.

ParameterTypeDirectionDescription
inFeatureCodeTextinThe feature code
inUnlockCodeTextinUnlock code
userNameTextinUser name

Fnd_Reg_RegistrationDialog

Fnd_Reg_RegistrationDialog ({feature code})

Displays the registration dialog. Works even if the product has been registered.

Sets the OK button if a valid registration number was entered.

ParameterTypeDirectionDescription
inFeatureCodeTextinFeature code (optional)

Fnd_Reg_RegistrationState

Fnd_Reg_RegistrationState ({feature code}) --> Longint

Returns the current registration state.

It can be one of these constants: Fnd_Reg_PreDemo Fnd_Reg_Demo Fnd_Reg_Expired Fnd_Reg_Registered

ParameterTypeDirectionDescription
inFeatureCodeTextinThe feature code (optional)
ResultLongintoutThe current registration state

Fnd_Reg_Reset

Fnd_Reg_Reset ({feature code})

Clears out the start date and other information for the specified feature.

ParameterTypeDirectionDescription
inFeatureCodeTextinThe feature code (optional)

Fnd_Reg_SaveRecord

Fnd_Reg_SaveRecord (product code)

Saves the current [Fnd_Reg] record after first setting the Checksum field.

Assumes the record is loaded in read/write mode.

Leaves the record loaded.

Use Fnd_Reg_VerifyRecord to verify the checksum.

ParameterTypeDirectionDescription
secretKeyTextinThe secret product code

Fnd_Reg_SaveRegistrationInfo

Fnd_Reg_SaveRegistrationInfo (feature name; personalization; license info; unlock code)

Save's the specified info into a registration record.

Doesn't check to make sure the unlock code is valid. We'll assume whoever called us did that.

ParameterTypeDirectionDescription
inFeatureCodeTextinFeature name
userNameTextinPersonalization
licenseInfoTextinLicense info
unlockCodeTextinUnlock code

Fnd_Reg_SetHostVars

Fnd_Reg_SetHostVars (->text; ->text; ->text; ->text; ->longint; ->longint; ->longint)

Called by the Buy Now button method of the Fnd_Reg_DemoDialog form to pass some pointers to host variables to the component.

ParameterTypeDirectionDescription
hostFeatureNamePointerinHost feature name
hostMessage1PointerinHost message 1
hostMessage2PointerinHost message 2
hostCountDownPointerinHost count down
hostOKButtonPointerinHost OK button
hostRegisterButtonPointerinHost Register button
hostBuyNowPointerinHost Buy Now button

Fnd_Reg_SetSecretKey

Fnd_Reg_SetSecretKey (key)

Allows the developer to set the secret key.

For security reasons, there is no routine to get the secret key.

Fnd_Reg licenses the host developer's application, not Foundation: it shows the host's demo and registration dialogs and checks the unlock codes the host issues.

Security: Fnd_RegG_GenerateUnlockCode ships in Foundation's source, so a host must set its own key with Fnd_Reg_SetSecretKey at startup. The MD5-based codes deter casual copying only; they are not copy protection.

ParameterTypeDirectionDescription
keyTextinThe secret key

Fnd_Reg_StartDemoPeriod

Fnd_Reg_StartDemoPeriod ({feature code})

Call this to begin the demo period. If the demo period has already been started, this routine will do nothing.

ParameterTypeDirectionDescription
inFeatureCodeTextinFeature code (optional)

Fnd_Reg_ValidateUnlockCode

Fnd_Reg_ValidateUnlockCode (secret key; feature code; user name; license info; unlock code; format) --> Boolean

Returns True if a valid unlock code was passed for the specified product number and user name.

Strip any license info before calling.

ParameterTypeDirectionDescription
secretKeyTextinThe unique product secret key
featureCodeTextinThe feature code
personalizationTextinThe user name
licenseInfoTextinThe license information
enteredUnlockCodeTextinThe user-entered unlock code
formatTextinThe license code format string
ResultBooleanoutTrue if the entered unlock code equals the generated unlock code

Fnd_Reg_VerifyRecord

Fnd_Reg_VerifyRecord

Makes sure the current [Fnd_Reg] record's Checksum field is correct.

If not, the record is updated so that it is expired. Theoretically this will happen only if the user tampers with a [Fnd_Reg] record. Otherwise processing is allowed to continue uninterrupted.

Assumes that there is exactly one record in the current selection.

Fnd_Reg_SaveRecord is called to set the checksum.

No parameters.