CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6

Threaded View

  1. #4
    Join Date
    Jun 2005
    Location
    JHB South Africa
    Posts
    3,772

    Re: Anti-Piracy Software Recommendations

    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
    If you have any Queries dont hesitate to ask ...

    Gremmy
    Attached Files Attached Files
    Articles VB6 : Break the 2G limit - Animation 1, 2 VB.NET : 2005/8 : Moving Images , Animation 1 , 2 , 3 , User Controls
    WPF Articles : 3D Animation 1 , 2 , 3
    Code snips: VB6 Hex Edit, IP Chat, Copy Prot., Crop, Zoom : .NET IP Chat (V4), Adv. ContextMenus, click Hotspot, Scroll Controls
    Find me in ASP.NET., VB6., VB.NET , Writing Articles, My Genealogy, Forum
    All VS.NET: posts refer to VS.NET 2008 (Pro) unless otherwise stated.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured