Results 1 to 14 of 14

Thread: Daily Limit use of program

  1. #1

    Thread Starter
    Member
    Join Date
    Nov 2009
    Posts
    40

    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.

  2. #2

  3. #3
    Next Of Kin baja_yu's Avatar
    Join Date
    Aug 2002
    Location
    /dev/root
    Posts
    5,989

    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.

  4. #4
    PowerPoster Spoo's Avatar
    Join Date
    Nov 2008
    Location
    Right Coast
    Posts
    2,656

    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

  5. #5

    Thread Starter
    Member
    Join Date
    Nov 2009
    Posts
    40

    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..

  6. #6
    PowerPoster Spoo's Avatar
    Join Date
    Nov 2008
    Location
    Right Coast
    Posts
    2,656

    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

  7. #7
    Next Of Kin baja_yu's Avatar
    Join Date
    Aug 2002
    Location
    /dev/root
    Posts
    5,989

    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.

  8. #8
    Next Of Kin baja_yu's Avatar
    Join Date
    Aug 2002
    Location
    /dev/root
    Posts
    5,989

    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

  9. #9
    PowerPoster Spoo's Avatar
    Join Date
    Nov 2008
    Location
    Right Coast
    Posts
    2,656

    Re: Daily Limit use of program

    baja

    Nice.. much cleaner than my approach.

    Spoo

  10. #10

    Thread Starter
    Member
    Join Date
    Nov 2009
    Posts
    40

    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..

  11. #11
    PowerPoster RhinoBull's Avatar
    Join Date
    Mar 2004
    Location
    New Amsterdam
    Posts
    24,132

    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.

  12. #12
    Next Of Kin baja_yu's Avatar
    Join Date
    Aug 2002
    Location
    /dev/root
    Posts
    5,989

    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.

  13. #13

  14. #14

    Thread Starter
    Member
    Join Date
    Nov 2009
    Posts
    40

    Re: Daily Limit use of program

    Quote Originally Posted by RhinoBull View Post
    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
  •  



Click Here to Expand Forum to Full Width