a) Select the "Project" menu, and then "References". Scroll down and select "RedRegistration (tm)…". And select "OK"
b) Open Module1, and add the following code at the top of the module.
Public cRedReg As RedRegistration3.RedReg3
Public bRegistrationIsValid As Boolean
Const nChecksum = 2697c) The next step is to initialize RedRegistration, first creating the object, and then initialize with your developer code. Do this by adding the following code to the beginning of procedure Main:
Dim lRetVal As Long
Dim bRetVal As BooleanSet cRedReg = New RedRegistration3.RedReg3
lRetVal = cRedReg.InitRegistration("Demo Developer", "Demo Company", "E1A479-7016-RG-JZKDJ-16")
If (lRetVal <> nChecksum) Then
Exit Sub
End Ifd) The value returned by InitRegistration should be your checksum. This is verified to ensure that RedRegistration is active, and has not been compromised. Only if the value matches the code you received when registering will RedRegistration protect your software. If the value does not match, you should abort in your code. Now that we have successfully registered RedRegistration with your developer code, it is time to retrieve the users registration. The method we use is LoadRegistration. This function assumes that a registration was previously saved using the method SaveRegistration. If LoadRegistration returns FALSE, then no registration exists, and the program should assume that we are in demo mode. If it returns TRUE, then we must verify the code is actually valid. A TRUE return from LoadRegistration only indicates that values where found, and that the properties UserName, CompanyName, RegCode, and Rights have been restored to their previous state. This does not indicate that the registration is valid, so the method Registered must be called.
Add the following code below the above code.
bRetVal = cRedReg.LoadRegistration("Your Rights")
If (bRetVal) Then
bRegistrationIsValid = cRedReg.Registered()
Else
bRegistrationIsValid = False
End If