Murray Brown
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?
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?
are you sure that CreateRegKeys has been called successfully at least once?
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 "1EB9F900E0B160247FF8C9B89 9DE541B"
So CreateRegKeys(txtPassPhras e.Text) never runs. Should I perhaps just
run the CreateRegKeys(txtPassPhras e.Text) the very first time my app is run?
I had run your Demo project. Maybe that ran CreateRegKeys(txtPassPhras e.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.RegistryKe y
oReg = Microsoft.Win32.Registry.C urrentUser .OpenSubKe y("Softwar e", True)
oReg = oReg.CreateSubKey(kstrRegS ubKeyName)
oReg = Microsoft.Win32.Registry.C urrentUser .OpenSubKe y("Softwar e\\" & kstrRegSubKeyName)
Dim strOldDay As String = oReg.GetValue("UserSetting s", "").ToString
Dim strOldMonth As String = oReg.GetValue("operatingsy stem", "").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(txtPassPhras e.Text)
End If
oTest_Status as my main form loads. When this code runs the
variable strOldDay contains the value "1EB9F900E0B160247FF8C9B89
So CreateRegKeys(txtPassPhras
run the CreateRegKeys(txtPassPhras
I had run your Demo project. Maybe that ran CreateRegKeys(txtPassPhras
Private Sub btnApplicationStatus_Click
Call oTest_Status()
End Sub
Public Sub oTest_Status()
Try
Dim oReg As Microsoft.Win32.RegistryKe
oReg = Microsoft.Win32.Registry.C
oReg = oReg.CreateSubKey(kstrRegS
oReg = Microsoft.Win32.Registry.C
Dim strOldDay As String = oReg.GetValue("UserSetting
Dim strOldMonth As String = oReg.GetValue("operatingsy
Dim strOldYear As String = oReg.GetValue("GUID", "").ToString
Dim strRegName As String = oReg.GetValue("USERID", "").ToString
Dim strRegCode As String = oReg.GetValue("LOCALPATH",
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(txtPassPhras
End If
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks