In the sample project Calc Demo 1 , the registration process demonstrates the use of LoadRegistration and SaveRegistration. The Registration screen shown below has three fields that are User-Input screens. These fields are used to test for a valid registration code. If the registration code is valid, then the registration information is saved to the users registry.
This example modifies the example given for manual loading of data. The function CheckUserRestrictions has been modified to use the LoadRegistration method.
Public Function CheckUserRestrictions() As Boolean
' Verify that the user registration information is correct. This compares
' the Username, Companyname, Rights, & RegCode to the developers
' registration. If this passes, then the return value is true.
' This does not test the Expiration, or RunTimes. That should be tested after
' this function returns TRUE
Dim lRetVal As Long
Dim bRetVal As Boolean
'Load the variables into redreg
lRetVal = RedReg.LoadRegistration("AppRights")
If lRetVal = True Then
'Determine if the registration code was valid
lRetVal = RedReg.Registered
If (lRetVal = True) Then
'The registration Passed
bRetVal = True
Else
'The registration failed. Test RedReg.LastError for a reason why
bRetVal = False
End If
Else
bRetVal = False
End If
CheckUserRegistration = bRetVal
End Function