Hello,
I need my app to expire after 30 days of use. How can I do this?
If you dont have the code just tell me the process to make it a trial one then I'll research a little more.
Thanks in advance
adol
Printable View
Hello,
I need my app to expire after 30 days of use. How can I do this?
If you dont have the code just tell me the process to make it a trial one then I'll research a little more.
Thanks in advance
adol
You could write the system date to a registry key when the app first runs...
Or you could write the system date to a data file in the Windows directory (no one ever looks there)...
See a thing called "search" at the top, use it, many people have asked this question
You need to get the date when the program first runs, then store it somewhere in the registry, most likely encrypted, then when the program loads each time after that, it should check that encrypted registry key. If the current date is 30 days after the first date the program was run, then you need to disable the program. The thing is that this isn't the best way to release software. People can easily find ways to crack software with full features and 30 day trials. It is better to strip some code out of the trial version, like completely remove the option to save. Then they cannot crack the program, and you will end up making more money if people want the software.
Begs the question....
what is the most accurate way to check if one "Date" is more than 30 days past another "Date"?
here is a sample. not a good protection, but it should give you some ideas :)
VB Code:
'Author: Reginald Wheat Option Explicit Public Function DateGood(NumDays As Integer) As Boolean 'The purpose of this module is to allow you to place a time 'limit on the unregistered use of your shareware application. 'This module can not be defeated by rolling back the system clock. 'Simply call the DateGood function when your application is first 'loading, passing it the number of days it can be used without 'registering. ' 'Ex: If DateGood(30)=False Then ' CrippleApplication ' End if 'Register Parameters: ' CRD: Current Run Date ' LRD: Last Run Date ' FRD: First Run Date Dim TmpCRD As Date Dim TmpLRD As Date Dim TmpFRD As Date TmpCRD = Format(Now, "m/d/yy") TmpLRD = GetSetting(App.EXEName, "Param", "LRD", "1/1/2000") TmpFRD = GetSetting(App.EXEName, "Param", "FRD", "1/1/2000") DateGood = False 'If this is the applications first load, write initial settings 'to the register If TmpLRD = "1/1/2000" Then SaveSetting App.EXEName, "Param", "LRD", TmpCRD SaveSetting App.EXEName, "Param", "FRD", TmpCRD End If 'Read LRD and FRD from register TmpLRD = GetSetting(App.EXEName, "Param", "LRD", "1/1/2000") TmpFRD = GetSetting(App.EXEName, "Param", "FRD", "1/1/2000") If TmpFRD > TmpCRD Then 'System clock rolled back DateGood = False ElseIf Now > DateAdd("d", NumDays, TmpFRD) Then 'Expiration expired DateGood = False ElseIf TmpCRD > TmpLRD Then 'Everything OK write New LRD date SaveSetting App.EXEName, "Param", "LRD", TmpCRD DateGood = True ElseIf TmpCRD = Format(TmpLRD, "m/d/yy") Then DateGood = True Else DateGood = False End If End Function 'Usage Private Sub Form_Activate() If Not DateGood(30) Then MsgBox "Trial Period Expired!", vbExclamation, "Unregistered application" Unload Me End If End Sub