Link to home
Start Free TrialLog in
Avatar of Murray Brown
Murray BrownFlag for United Kingdom of Great Britain and Northern Ireland

asked on

VB.net initiating the trial period in security software

In the following demo application

http://www.emoreau.com/Entries/Articles/2007/12/Licensing-a-VBNet-application.aspx

I imported Form1 into my project as well as the two class modules.

I run the code behind  "Test Status" as my main form starts

and have noticed that it says that I have 30 days left for the past three

days. What do I do to get the Trial days ticking down?
Avatar of Éric Moreau
Éric Moreau
Flag of Canada image

are you sure that CreateRegKeys has been called successfully at least once?
Avatar of Murray Brown

ASKER

I don't think it has. As you can see I have moved the code around and call the procedure
oTest_Status as my main form loads. When this code runs the
variable strOldDay  contains the value "1EB9F900E0B160247FF8C9B899DE541B"
So CreateRegKeys(txtPassPhrase.Text) never runs. Should I perhaps just
run the CreateRegKeys(txtPassPhrase.Text) the very first time my app is run?
I had run your Demo project. Maybe that ran CreateRegKeys(txtPassPhrase.Text)


    Private Sub btnApplicationStatus_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnApplicationStatus.Click
        Call oTest_Status()
    End Sub

    Public Sub oTest_Status()
        Try
            Dim oReg As Microsoft.Win32.RegistryKey
            oReg = Microsoft.Win32.Registry.CurrentUser.OpenSubKey("Software", True)
            oReg = oReg.CreateSubKey(kstrRegSubKeyName)
            oReg = Microsoft.Win32.Registry.CurrentUser.OpenSubKey("Software\\" & kstrRegSubKeyName)
            Dim strOldDay As String = oReg.GetValue("UserSettings", "").ToString
            Dim strOldMonth As String = oReg.GetValue("operatingsystem", "").ToString
            Dim strOldYear As String = oReg.GetValue("GUID", "").ToString
            Dim strRegName As String = oReg.GetValue("USERID", "").ToString
            Dim strRegCode As String = oReg.GetValue("LOCALPATH", "").ToString
            Dim strCompID As String = oReg.GetValue("CompID", "").ToString
            Dim strTrialDone As String = oReg.GetValue("Enable", "").ToString
            oReg.Close()

            'If the keys should automatically be created, then create them.
            If strOldDay = "" Then
                CreateRegKeys(txtPassPhrase.Text)
            End If
ASKER CERTIFIED SOLUTION
Avatar of Éric Moreau
Éric Moreau
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks