|
-
Apr 2nd, 2010, 07:23 AM
#1
Thread Starter
Member
Daily Limit use of program
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.
-
Apr 2nd, 2010, 07:30 AM
#2
Re: Daily Limit use of program
 Originally Posted by jijiey
I would like to create a daily use limitation on my application...
What's the purpose?
-
Apr 2nd, 2010, 08:02 AM
#3
Re: Daily Limit use of program
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.
-
Apr 2nd, 2010, 09:01 AM
#4
Re: Daily Limit use of program
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
-
Apr 2nd, 2010, 09:06 AM
#5
Thread Starter
Member
Re: Daily Limit use of program
2 - number of times app start on the day..
I would like my friend just use my application just like 5 times a day..
-
Apr 2nd, 2010, 09:17 AM
#6
Re: Daily Limit use of program
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
-
Apr 2nd, 2010, 09:19 AM
#7
Re: Daily Limit use of program
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.
-
Apr 2nd, 2010, 09:21 AM
#8
Re: Daily Limit use of program
Here's the code for reading/writing to an INI file http://www.vbforums.com/showthread.php?t=349993
-
Apr 2nd, 2010, 09:22 AM
#9
Re: Daily Limit use of program
baja
Nice.. much cleaner than my approach.
Spoo
-
Apr 2nd, 2010, 09:26 AM
#10
Thread Starter
Member
Re: Daily Limit use of program
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..
-
Apr 2nd, 2010, 09:35 AM
#11
Re: Daily Limit use of program
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.
-
Apr 2nd, 2010, 09:37 AM
#12
Re: Daily Limit use of program
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.
-
Apr 2nd, 2010, 09:42 AM
#13
Re: Daily Limit use of program
true but the idea is to make it harder to crack - by all means ini file is the easiest way to break your app.
-
Apr 2nd, 2010, 09:55 AM
#14
Thread Starter
Member
Re: Daily Limit use of program
 Originally Posted by RhinoBull
true but the idea is to make it harder to crack - by all means ini file is the easiest way to break your app.
Yeah.. That's what I mean.. Make the program harder to crack.. But I think, the idea of encryption from both of you are enough. That's what I do now.. I though there is a better way to make it.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|