Results 1 to 5 of 5

Thread: How to create the 30-day limit on eval program?

  1. #1

    Thread Starter
    Junior Member
    Join Date
    May 2001
    Posts
    18

    How to create the 30-day limit on eval program?

    Great Ones,

    I'm writing a demo version of a program I'm intending to ultimately sell...but I want the demo version to only operate for 30-days.

    What is the best way to go about programming such a 30-day lock?

    Thank you in advance,
    Jeff

  2. #2
    Good Ol' Platypus Sastraxi's Avatar
    Join Date
    Jan 2000
    Location
    Ontario, Canada
    Posts
    5,134
    You could create a log in the registry saying what the install date was and what the date is now, therefore in 30 days exiting immediately. However, they could set it to be a day before that to overcome it. You'd probably have to do some kind of counter to get it to work properly.
    All contents of the above post that aren't somebody elses are mine, not the property of some media corporation.
    (Just a heads-up)

  3. #3

    Thread Starter
    Junior Member
    Join Date
    May 2001
    Posts
    18

    How to log/read/write in the Registry?

    Sastraxi,

    Your idea sounds great. I would just 'encrypt' (with some sort of simle formula) the two dates, making it harder for them to trivially 'hack' the dates. But how do you register and read/write into the registry from VB. Do you have an example or know where I could look in MSDN for example?

    Thank you

  4. #4
    -= B u g S l a y e r =- peet's Avatar
    Join Date
    Aug 2000
    Posts
    9,629
    VB Code:
    1. 'Author: Reginald Wheat
    2.  
    3. Option Explicit
    4.  
    5. Public Function DateGood(NumDays As Integer) As Boolean
    6.     'The purpose of this module is to allow you to place a time
    7.     'limit on the unregistered use of your shareware application.
    8.     'This module can not be defeated by rolling back the system clock.
    9.     'Simply call the DateGood function when your application is first
    10.     'loading, passing it the number of days it can be used without
    11.     'registering.
    12.     '
    13.     'Ex: If DateGood(30)=False Then
    14.     ' CrippleApplication
    15.     ' End if
    16.     'Register Parameters:
    17.     ' CRD: Current Run Date
    18.     ' LRD: Last Run Date
    19.     ' FRD: First Run Date
    20.  
    21.     Dim TmpCRD As Date
    22.     Dim TmpLRD As Date
    23.     Dim TmpFRD As Date
    24.  
    25.     TmpCRD = Format(Now, "m/d/yy")
    26.     TmpLRD = GetSetting(App.EXEName, "Param", "LRD", "1/1/2000")
    27.     TmpFRD = GetSetting(App.EXEName, "Param", "FRD", "1/1/2000")
    28.     DateGood = False
    29.  
    30.     'If this is the applications first load, write initial settings
    31.     'to the register
    32.     If TmpLRD = "1/1/2000" Then
    33.         SaveSetting App.EXEName, "Param", "LRD", TmpCRD
    34.         SaveSetting App.EXEName, "Param", "FRD", TmpCRD
    35.     End If
    36.     'Read LRD and FRD from register
    37.     TmpLRD = GetSetting(App.EXEName, "Param", "LRD", "1/1/2000")
    38.     TmpFRD = GetSetting(App.EXEName, "Param", "FRD", "1/1/2000")
    39.  
    40.     If TmpFRD > TmpCRD Then 'System clock rolled back
    41.         DateGood = False
    42.     ElseIf Now > DateAdd("d", NumDays, TmpFRD) Then 'Expiration expired
    43.         DateGood = False
    44.     ElseIf TmpCRD > TmpLRD Then 'Everything OK write New LRD date
    45.         SaveSetting App.EXEName, "Param", "LRD", TmpCRD
    46.         DateGood = True
    47.     ElseIf TmpCRD = Format(TmpLRD, "m/d/yy") Then
    48.         DateGood = True
    49.     Else
    50.         DateGood = False
    51.     End If
    52. End Function
    53.  
    54.  
    55. 'Usage
    56.  
    57.  Private Sub Form_Activate()
    58.     If Not DateGood(30) Then
    59.         MsgBox "Trial Period Expired!", vbExclamation, "Unregistered application"
    60.         Unload Me
    61.     End If
    62. End Sub

    yet another sample
    -= a peet post =-

  5. #5
    Zaei
    Guest
    SaveSetting would be almost worse then an ini, or simple text file stored in the program Directory. Do a search for "VB" in your registry,, and you should find a folder eventually that has nothing but Registry Entires put there using SaveSetting. This location is the same in everyone's registry.

    If you are going to use the registry, look up the Registry functions in MSDN, and learn to use them. Hide your settings with some strage name, in some strange place.

    You might also want to create a binary file in your Windows\System32 directory, renamed to <something>.DLL. Encrypt the date so there is nothing but numbers. The first number in the file should be the length of the date, then the date, followed by several kilobytes of junk.

    Z.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width