Results 1 to 2 of 2

Thread: Trial Periods

  1. #1
    Join Date
    Aug 2004
    Posts
    82

    Exclamation Unanswered: Help

    Is there any way I can make a program shut down after being used for 3 days


    Thanx in advance

    Jwman
    Last edited by jwman; 10-16-04 at 13:05. Reason: Rephrased

  2. #2
    Join Date
    Jun 2004
    Location
    Arizona, USA
    Posts
    1,848
    One very simple way would be to use the vb registry commands GETSETTING and SAVESETTING.

    In the form load event (or the main module code), add the following (untested, though it should work) code.

    Code:
    Dim dtStart as Date
    Dim strStart as String
    
    strStart = Getsetting (App.ExeName, "SETTINGS", "START", "")
    If strStart = "" then 
      ' First Time the App has been Run, so save the time in the registry & continue
      SaveSetting App.ExeName, "SETTINGS", "START", cStr(Now()
    Else
      If DateDiff ("d",dtStart,Now()) > 3 then
        MsgBox "This app has been installed for more than 3 days, you BAD Boy!"
        Dim f as frm
        for each f in Forms
          unload me
        next f
      Else
        ' The app has been installed for less than three days, so it's OK to run
        ' so, do nothing & continue on
        MsgBox "This app is running on it's three day trial period, which began" & strStart & "."
    
      Endif
    Endif
    Last edited by loquin; 10-21-04 at 20:15.
    Lou
    使大吃一惊
    "Lisa, in this house, we obey the laws of thermodynamics!" - Homer Simpson
    "I have my standards. They may be low, but I have them!" - Bette Middler
    "It's a book about a Spanish guy named Manual. You should read it." - Dilbert


Posting Permissions

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