Escolar Documentos
Profissional Documentos
Cultura Documentos
NET
Start Visual Studio 2010 => Create New Project => select Class Library => Name it
MyTrialVersionApp.
Write The Following Code In it.
Imports Microsoft.Win32
Public Class RegistryTrial
Private Last, First, RemainsDays, RemainsDays1, strOldDay, strOldMonth,
strOldYear As String
'Number of Days Of the trial version.
Private mintSystem_UsedTrialDays As Integer 'Number of days system used
Public StartDate As String
Public LastDate As String
Public FinalDate, FinalDateTime As String
Public Function Regedit(ByVal TrialPeriod As Integer) As String
'It first create Key then Stored value in it
Dim regKey As RegistryKey
Try
Dim strRet As String = ""
regKey = Registry.LocalMachine.OpenSubKey("SOFTWARE", True)
regKey = Registry.LocalMachine.OpenSubKey("Software\AppSecurity", True)
If regKey Is Nothing Then
regKey = Registry.LocalMachine.OpenSubKey("SOFTWARE", True)
regKey.CreateSubKey("AppSecurity")
regKey.Close()
If WriteValue(TrialPeriod) = False Then
Return "setting fail."
End If
Else
strRet = GetValueFromReg(TrialPeriod)
Return strRet
End If
Catch ex As Exception
Return ""
End Try
End Function
Else
strReturn = GetLastAccessDateTime()
If strReturn <> "LogIn" Then
Return strReturn
Else
If RemainsDays1 = Nothing Then
Return "123Today is your last day in your free trial period."
Else
Return "123You have " & RemainsDays1 & " days remaining in your free
trial period."
End If
End If
End If
Else
End Function
FinalDateTime = funcEncrpt_Date(SaveLastAccessdate)
regKey.SetValue("System_Used", FinalDateTime)
regKey.Close()
Catch ex As Exception
End Try
End Sub
After writing this code in the Class Library Application Save it And Run it
The DLL get created in the Bin Folder Of your Application.
Copy it and Paste In your another application where you want to use it(i.e. 10 days
trial version application you want to make)
Open your another project => Click on Project => Add reference
To see it
Write the Following Code on this application
Windows.Forms.DialogResult.Yes Then
Dim obj As NewTrial_Version.RegistryTrial
obj.SaveLastAceessDateTime()
Me.Close()
Else
Me.Show()
End If
Click on Strart => RUN and Type regEdit and press OK Buton