have app stop functioning after time has expired

Hi all!

I wrote an app that is a demo and has some limits until a registration key is entered.
What I would like to do is take out the limits and have it fully functional instead, but have a time limit, maybe 30 days or something, at which point the program will
not run any more.
I don't know how to do that. Does any one here know?? I am using VB6
If it involves the registry, (which I assume it does), then some short details or example code would be very appreciated, because I know very little about the registry.

Here is the current version if you want to look at it....


LVL 23
Who is Participating?
mcriderConnect With a Mentor Commented:
This is a very simple generalized solution that does not take encryption or anything like that into consideration...

Add the following to your program:

    Dim InstallDate As String
    InstallDate = GetSetting(App.ProductName, "STARTUP", "INSTALL_DATE", "")
    If InstallDate = "" Then
        InstallDate = Format(Now, "mm/dd/yyyy")
        SaveSetting App.ProductName, "STARTUP", "INSTALL_DATE", InstallDate
    End If
    If DateDiff("d", InstallDate, Now) > 30 Then
        MsgBox "30 days has expired!"
    End If

Make sure you set the application's productname at build time before you run this.  To do this:

   Click "Project->Project Properties..."
   Click the "Make" tab
   In the Version Information area, scroll down to "Product Name" in the TYPE listbox and add your project's name to the VALUE field.

Hope this helps!

ahammarAuthor Commented:
Thank you!
I'll let you know in 30 days if it works
Just kidding.......:-)
It looks like it is going to work fine from the tests I've run.

Other than resetting their systems date or by hacking, do you know if there is a way for someone to beat or bypass this method.
You've done your part and I think it is an Excellent answer that will work very well, so if your busy don't bother explaining what I just asked. It's not important, I'm just curious.

I really like this!  You don't know how glad I am that it's this simple!

Thanks again!

How to crack? Click on "Start"-button, choose "Run" -> type in "Regedit" -> go to HKEY_CURRENT_USE\Software\VB and VBA Program Settings\{The name of your program here}\Startup\ -> change the value of the Install_date data.

Wow, I feel like a real cracker now <g>
Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

Thanks for the points! Glad I could help!

I always try to follow-up answers...  

Keying registrations to programs in windows has always been a nightmare because there is ALWAYS someone smart enough to "figure it out".  If you get a user that is a "registry snooper" and watches the registry keys as they are written, all they have to do is delete the registry key and they've "busted" your program.  90% of users are just not that smart.  It's that other 10% you have to worry about.

You can get really sneaky and use a concept call "stub loading"... Basically it works like this:

ProgA is the stub.  ProgB is your actual program, but it is an encrypted file... Let's say the last 10 bytes of this encrypted file is the date that the program was installed.

When you run ProgA it decripts ProgB, checks the last 10 bytes of the file to see if the license has expired and then executes ProgB if the license is OK.  If the license is expired, ProgA issues a "too bad, register me" message and quits.

The really cool thing about this is you can add the 10 bytes to ProgB AFTER it has been compiled by opening the ProgB.EXE in BINARY mode and appending the 10 bytes without affecting how the program runs.

I could ramble on for days on this subject...


BTW, Vbmaster IS one of those 10%'ers...

ahammarAuthor Commented:
Thanks guys! You mean that code makes a registry entry?
I didn't know that's how it worked, but that suits me fine!

I'm not worried about the 10% who would try and crack it (although I didn't want to make it too easy), I was just curious how easy it would be. I know there's going to be hackers and such, but I figure there's not a whole lot I can do about it, so I just wanted a way that would work good, and let it go at that.
I could have done it by simply having it create and write to an encrypted file buried deep somewhere in windows, but I figured that would be to easy to crack/hack. I think this is much better.
 (Maybe I'll see if I can figure out how to do it both ways in the same app..)

This is very interesting to me! Thank you for sharing that with me. I'm glad you told me this stuff!

Thank you again!
In case you downloaded it and want the Reg key, just let me know by e-mail, and I'll send it to you.

Sure... mcrider@caas.com

All Courses

From novice to tech pro — start learning today.