Home » Category » Microsoft Visual Basic

Microsoft Visual Basic: "30 Restriction"

104| Sat, 01 Dec 2007 19:05:00 GMT| mrnick| Comments (6)
How do I have my program run for 30 days after the first time its ran, and then state the shareware time limit has ran out?
Thanks in advance.

Keywords & Tags: 30, restriction, microsoft, visual basic, vb

URL: http://www.programmerbase.com/visual-basic/89/
 
«« Prev - Next »» 6 helpful answers below.
Oops... The title should read 30 day Restriction!

mrnick | Mon, 03 Dec 2007 22:00:00 GMT |

How secure do you want it?

Basically you'll need to store the day they installed it somewhere, then use DateDiff to work out if 30 days are up.

'Code to load/decrypt thte date installed
If DateDiff("d", DayInstalled, Date) >= 30 Then
Msgbox "Please buy this lovely product."
End If

slh | Mon, 03 Dec 2007 22:01:00 GMT |

The way I handle it i to create to files at firts run of application...

1) Stores the 1st date accessed (this is the date that SLH mentions referencin to when it expires).

2) A second to let the app know it has been installed before (reason for this - what's to stop user from reinstalling the file? So when they reinstall, launch again, the app see files 2 in place and knows it has been reinstalled...)

Just my change of the subject...

jamesstanich | Mon, 03 Dec 2007 22:02:00 GMT |

Originally posted by James Stanich
A second to let the app know it has been installed before (reason for this - what's to stop user from reinstalling the file? So when they reinstall, launch again, the app see files 2 in place and knows it has been reinstalled...)

Or, a simpler way would be to get the installer to check for, and not over-write any install date info.

slh | Mon, 03 Dec 2007 22:03:00 GMT |

I see your point SLH but i'm a junior member of both this Forum and VB, could you please explain a bit further? perhaps with examples?

I just basically want to know when 30 day's have elapsed and run some code accordingly.

Thanks.

mrnick | Mon, 03 Dec 2007 22:05:00 GMT |

Search for uses of the SaveSetting, and GetSetting API (you can use them to store when you installed/first ran your app in the registery. Then, when you load your app, use GetSetting to retrieve the date first ran. You can then use the code i posted above to check the for the 30 days.

slh | Mon, 03 Dec 2007 22:06:00 GMT |

Microsoft Visual Basic Hot Answers

Microsoft Visual Basic New questions

Microsoft Visual Basic Related Categories