Hey there..
I would like to create a daily use limitation on my application.. I would like to ask if someone here in vbforums can give me some sample or idea or link to project like this on internet?
I could not find it.. Hope someone can help me.
Printable View
Hey there..
I would like to create a daily use limitation on my application.. I would like to ask if someone here in vbforums can give me some sample or idea or link to project like this on internet?
I could not find it.. Hope someone can help me.
When your applicaiton starts, grab the current date/time using Now function and store it in a variable. Then have a timer set interval to 60000 (1 minute) and in it have it execute a DateDiff to compare the stored (start time) with the current (Now) time. If the difference is greater than the limit you want to impose show a message and close the application.
You will also need to store that somewhere (INI file, registry...) so the user can't just restart the application.
jij
By "daily use limitation" - do you mean ...
1. measured by time (per baja's post)
2. measured by number of times the app is started in a day
3. something else
Spoo
2 - number of times app start on the day..
I would like my friend just use my application just like 5 times a day..
jij
If security is not an issue, then you could read/write to a
text file, as in:
1. app is started - write date and use=1 to Use.txt
2. app is started again same day
- read from Use.txt - use is OK .. allow to proceed
- write to Use.txt - increment use to 2
3. d.o. -- Use.txt incremented to 3
4. d.o. -- Use.txt incremented to 4
5. d.o. -- Use.txt incremented to 5
6. use exceeds allowed -- app closes
If security IS an issue, then perhaps write to INI file, registry
per baja's suggestion (ask him -- I've never worked with those files)
How would you like to proceed?
Spoo
That's even easier then. Search the forum for "save settings" you will have examples on how to save and load any type of setting for your application.
You need to keep two settings: Run Count, and Last run Date. On Form_Load load saved settings.
If LastRunDate is not today, reset the RunCount. If it is the same day, increment the RunCount by 1. Then check the RunCount if it is greater than 5 (your run limit). If it is show a message and close the application.
Here's the code for reading/writing to an INI file http://www.vbforums.com/showthread.php?t=349993
baja
Nice.. much cleaner than my approach.
Spoo
Yeah I know about it..
But the problem is, its easy to crack it..
Example if someone just copy the original INI file then replace when it reach the limit, they will easily use my application over and over again..
INI file can easily be altered - writing to registry (encrypted key/value) is much better approach.
You can also create a file with encrypted name/content and save it to some directory that would be hard to guess what it actually means.
You should also be aware that anything can be cracked. If it was otherwise companies like Microsoft, Adobe and such wouldn't have problems with piracy. And don't forget about the gaming industry. So make something with basic encryption, it should be enough to keep the novice and intermediate level users away, but don't expect to stop them all.
true but the idea is to make it harder to crack - by all means ini file is the easiest way to break your app.