Attached is the VB.net (2008) project that will allow you to add a better key activation module to your application..
Here is a how it would be used in your application..
Code:
Private CodeProtect As New ProdKey
Private Sub GetActivation(ByRef Expires As Boolean, ByRef ExpiresDate As Date)
Dim KEY As String = CodeProtect.GenKey
Dim UnlockKey As String = InputBox("Please enter the activation code " & _
"(Call 011 608 1121 for assistance, and provide " & vbNewLine & vbNewLine & _
KEY & vbNewLine & _
" as reference number):", _
"CashFlow3", "")
If Not CodeProtect.ActivateProduct(Application.StartupPath, UnlockKey, Expires, ExpiresDate) Then
MsgBox("Wrong Code, please call 011 608 1121 for assistance, and provide " & vbNewLine & _
KEY & " as reference number", MsgBoxStyle.Information)
ExitApp = True
Application.Exit()
End If
End Sub
Private Sub MainForm_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim ExpiresDate As Date
Dim Expires As Boolean
If Not CodeProtect.CheckIfLegal(Application.StartupPath, Expires, ExpiresDate) Then
GetActivation(Expires, ExpiresDate)
End If
While Expires And ExpiresDate < Date.Now And Not (ExitApp)
MsgBox("The licence has Expired, Please click OK to enter a new Activation Code")
GetActivation(Expires, ExpiresDate)
End While
NOTE: it would be best you change the way VALS string is built in the GenKey Function and the key calculation in the Calk_Licen_Key Function.
In the 4 apps that we are using this in, we have the same Complex calculation in the Calk_Licen_Key (in the sample i left a simple Eor calculation in there), and changed the VALS build so that a we can use a central KeyGen Application for all the app's but keys are not compatable across the apps...
To generate the unlocking key you simply Have a Textbox to enter the supplied code, a Checkbox to show if the code expires, a DateTimePicker to select the expiry date of the code, and a Textbox to display the Unlock Code..
Code:
Private Sub GenUnlock_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button10.Click
Dim Ukey As String
Ukey = KeysGen.GenUnlock(TxtAKey.Text.Trim, CBExpire.Checked, DTPExpire.Value)
If Ukey.Length <> 0 Then
TxtACode.Text = Ukey
Else
MsgBox("Invalid Key Entered", MsgBoxStyle.OkOnly, "Activation Code")
Exit Sub
End If
* The Best Reasons to Target Windows 8
Learn some of the best reasons why you should seriously consider bringing your Android mobile development expertise to bear on the Windows 8 platform.