vb.net - Delete registry after year Vb net -


How can I make my license work only for one year? When I activated my program, I add the registry to the current date. On every run, I check whether the registry exists or not. If the registry is present then I can use my application otherwise it is prompted for me to activate.

I have to do that my license works only one year.

I tried

pre-> public sub-licence_heck () dim delayed days as the licenca integer as licenca = CDate (My.Computer.Registry.GetValue ("HKEY_CURRENT_USER \ tFull", "tFull", is nothing)) day = CInt (365 - (DateDiff (DateInterval.Day, licenca, now)) then the day & lt; = 0 Then My.Computer.Registry.CurrentUser.DeleteValue ("tFull") pbInfo.Value = pbInfo.Maximum gpbInfo.Text = "More than one year license" RbContinue.Enabled = false end then End Sub

" itemprop = "text">

I have already warned you of weakness of this approach, but this is that you gave up You can write License_Check

  Public sub-license (check) as TempKey = My.Computer.Registry.Cur rentUser.OpenSubKey ("Software \ YourAppNameHere", true) licenca = CDate (tempKey.GetValue ("InstallDate", nothing is)) slow Ima = licenca.AddYears (1) If the range of & lt; DateTime.Today tempKey.DeleteValue ("InstallDate") Console.WriteLine ("more than one year license") from end to end, using the end subs, then  

A subkey should store information about your application in the Software subkey and not directly under the root code HKEY_CURRENT_USER . After that you need to ask to write the appropriate permissions and after all, read the price uniform.

To check dates, just read the value of 1 year and check for today's investigation. You must use the DeleteValue method of the open subkey to delete.

Apart from this, I think that this is not a test which should be applied to the user by user base. Instead it is an investigation that can be applied to the entire application. In this case you should use the predefined My.Computer.Registry.LocalMachine registry key.


Comments

Popular posts from this blog

winforms - C# Form - Property Change -

java - Messages from .properties file do not display UTF-8 characters -

javascript - amcharts makechart not working -