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?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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!


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
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>
The Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

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

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.