Solved

Trial system

Posted on 1998-07-24
9
252 Views
Last Modified: 2010-05-03
Anybody got some sample code for a twenty day trial system?

Rob.
0
Comment
Question by:robjgreen
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 4
9 Comments
 
LVL 8

Expert Comment

by:MikeP090797
ID: 1466614
What do you mean? A program that will run for only 20 days since it's installation? How well protected should it be?
0
 

Author Comment

by:robjgreen
ID: 1466615
The user should not be able to stop it from expiring...
0
 
LVL 8

Accepted Solution

by:
MikeP090797 earned 100 total points
ID: 1466616
The general approach would be to store the installation in the registry, using DateValue so it will be stored as a long number and not as a readable date, and compare it to today's date. If the difference is more then 20 days, exit. If the date in the registry isn't found, exit. If you are planning it for the average user, using SaveSetting will be enough, he won't be able to modify the date. If you are planning it for high level experts, you should use Reg* APIs to store it elsewhere so noone will figure out it's your program, or store it in a file like prog10xs.dll in \windows\system directory, so the user won't figure it out either. Make the file 20KB long, so it won't look suspicious
0
Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

 

Author Comment

by:robjgreen
ID: 1466617
Hi Mike,
   Well, that is actually what I had done already, simply stored it in the registry... but I'm going to test your DateValue idea before I accept the answer (low on points!)

Kind Regs,
Rob Green.
0
 
LVL 8

Expert Comment

by:MikeP090797
ID: 1466618
Sorry, I posted it to early. DateValue won't do it, but you can store it like Day*10+Month*500+Year*7000
0
 

Author Comment

by:robjgreen
ID: 1466619
Hi Mike,
   it seems to be working okay... I'll have to get a decent install program that can set these things up though.

Kind Regards,
Rob Green.
0
 

Author Comment

by:robjgreen
ID: 1466620
Mike, erm... well I used this code:

Private Sub Form_Load()
    Dim installdat, currentdate As Long
    frmUnReg.Picture = frmSplash.Picture
    installdate = GetSetting("Heatwave Creations", "PasswordSafe", "gg1", "")
    currentdate = DateValue(Date)
    difference = currentdate - installdate
End Sub

Private Sub Timer1_Timer()
    If (20 - difference) > 0 Then
        frmPasswordSafe.Visible = True
        frmPasswordSafe.Enabled = False
        frmLogin.Visible = True
        Unload Me
    ElseIf (20 - difference) <= 0 Then
        MsgBox "Your Trial Has Expired"
        frmPreferences.Visible = True
        Unload Me
    End If
End Sub

But it doesnt work, it claims I have 40 days remaining!

Can you write me a code example please?

Kind Regards,
Rob Green.
0
 
LVL 8

Expert Comment

by:MikeP090797
ID: 1466621
Try something like:
Dim InstallDate as date
installdate = GetSetting("Heatwave Creations", "PasswordSafe", "gg1", "")

If DateDiff("m", Now, InstallDate)>20 then
'Exit
else
'Continue
End if
0
 

Author Comment

by:robjgreen
ID: 1466622
Its okay, I rewrote all the code and it works okay now...
Cant remember what was wrong... too noisy here to think.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
VBA filters 2 71
vb6 connector to SQL Server 2 42
Protecting vb6 & .Net code Obfuscation 18 184
Can we place a tooltip on the actual vb6 form 5 53
Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question