Results 1 to 9 of 9

Thread: Date & Time Problems

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Dec 2005
    Location
    Toronto, Canada
    Posts
    357

    Date & Time Problems

    Sup Programmers,
    I have been testing my program, and I realized that if any of my testers lend the program to other people, then the amount of customers would probably decrease for me.
    I need to create a code that checks if lets say 1 month has passed since the program was first opened. I will create a little password window to reset the timing to 0 days so I can reuse it. The only problem I have is that what If someone starts the program and 1 week later gives it to another user, would the start date still be the same? Would this 1 month free trial thing still work?
    And the main problem is that I don't know how to store dates, and work with them. So could someone please help me with this code. Remember I need to make sure that after an amount of days, including time, even if it is one minute past the 30 day period, the program either deletes itself or, loads a blank form that has a message to buy it.

    Khanjan
    Your help is extremely appreciated.
    Hey... If you found this post helpful please rate it.

  2. #2
    Fanatic Member lerroux's Avatar
    Join Date
    Nov 2005
    Location
    Welcome to the darkside... we have cookies
    Posts
    646

    Re: Date & Time Problems

    try to put your trial period date data in a textfile... after installation, i guess you can create a BAT file to create the file... then, everyday, let your app compare the system date from the date in the textfile... afterwards, you know wat to do...
    WARNING: Excessive coding is dangerous to your health... if symptoms persist insult your doctor...

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Dec 2005
    Location
    Toronto, Canada
    Posts
    357

    Re: Date & Time Problems

    But how do I collect the date when the program was first opened and store it in a text file? I am totally new to dates and stuff.

    I have no clue what a BAT file is.

    How about this, I can just create three files.
    1) Month
    2) Day
    3) Year

    Then I can use their names to check my dates by seperating each time section and matching them. Is it possible? Sounds weird to me.

    Is it also possible to make the program delete itself?
    Hey... If you found this post helpful please rate it.

  4. #4
    Frenzied Member d3gerald's Avatar
    Join Date
    Jan 2006
    Posts
    1,348

    Re: Date & Time Problems

    aside from creating a BAT file, you can also create a text file using vb to store such information.
    On error goto Trap

    Trap:
    in case of emergency, drop the case...

    ****************************************
    If this post has been resolved. Please mark it as "Resolved" by going through the "Thread Tools" above and clicking on the "Mark Thread Resolved " option.
    if a post is helpful to you, Please Rate it by clicking on the Rate link right below the avatar

  5. #5

    Thread Starter
    Hyperactive Member
    Join Date
    Dec 2005
    Location
    Toronto, Canada
    Posts
    357

    Re: Date & Time Problems

    But can someone please help me generate a code for this???
    Hey... If you found this post helpful please rate it.

  6. #6
    Lively Member
    Join Date
    Jan 2002
    Location
    Posts
    114

    Re: Date & Time Problems

    I hope this will be of your use http://www.activelock.com/

  7. #7
    Frenzied Member pnish's Avatar
    Join Date
    Aug 2002
    Location
    Tassie, Oz
    Posts
    1,918

    Re: Date & Time Problems

    You could do something like this:
    VB Code:
    1. Option Explicit
    2.  
    3. Dim RegDate As Date
    4.  
    5. Private Sub Form_Load()
    6.     '
    7.     '   Read the registry to get the install date
    8.     '
    9.     RegDate = GetSetting("MyApp", "Licence", "InstallDate", 0)
    10.     If RegDate = 0 Then
    11.         '
    12.         '   App hasn't been run before (on this machine)
    13.         '   So write the current date & time to the registry
    14.         '
    15.         SaveSetting "MyApp", "Licence", "InstallDate", Now
    16.     Else
    17.         '
    18.         '   Check whether more than 30 days has passed
    19.         '
    20.         If DateDiff("d", RegDate, Now) > 30 Then
    21.             MsgBox "This prog has expired"
    22.         End If
    23.     End If
    24.    
    25. End Sub
    Note that this is very simple to bypass. You only need to either delete the registry entry or modify the date stored there for this code to be useless. It will work OK for non tech-savvy users though.
    Pete

    No trees were harmed in the making of this post, however a large number of electrons were greatly inconvenienced.

  8. #8
    Frenzied Member Andrew G's Avatar
    Join Date
    Nov 2005
    Location
    Sydney
    Posts
    1,587

    Re: Date & Time Problems

    Instead of making the program expire after 1 month. Why not make it after 10 minutes/ or any other short time. That way if someone does pass it on to anyone else. It won't be much use as it will only work for 10 minutes before having to close it, and re-eopen it to reuse it.

  9. #9
    Conquistador
    Join Date
    Dec 1999
    Location
    Australia
    Posts
    4,527

    Re: Date & Time Problems

    Please search the forums next time! I think this question's probably been answered ~twice in the threads available on this forum's index!

    If your program is useful, a simple registry date check isn't going to stop that many people. The registry would be the first place i'd check for a datestamp if I wanted to keep using a program.

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