Mike9900 said:
That would not help, because the user would uninstall the software and
deletes the file with the directory. So the app can run again for another 30
times. I want the app to get expired after 30 uses.
The first thing you need to understand is that there is _no_ way for you
to absolutely prevent a user from running your application more than 30
times. The real question is how much effort do you want to put into it,
and how annoyed do you want your legitimate users to be?
I can tell you that I personally _really_ dislike applications that
don't uninstall completely. But that's essentially what you have to do
in order to have data stored on the user's computer to track the
expiration. You need to hide that data somewhere so that it's harder
for the user to find it.
Note that no matter how good a job you do of hiding the data, some user
_will_ find it. And the better a job of hiding the data you do, the
more likely you are to run into general impolite or downright slimy
implementation details.
One of the best trial mechanisms I've run across involves activating the
product with a key issued by the developer. The key is actually an
encrypted blob of data in user-readable text form (that is, just capital
letters and numbers) that contains either a permanent unlock code or
some time-limited code. For a trial, the company issues a time-limited
code, and once purchased they issue a permanent code.
I still am not a big fan of stuff like that, the main reason being that
I am forever dependent on either keeping track of my key or of the
company being around to issue a new one (see Microsoft's Product
Activate "feature" for an example of the latter, since even keeping a
copy of the key doesn't help you with their stuff). But at least it's
completely transparent. That is, the data's not being hidden anywhere
and I can in fact uninstall the application in a complete way, since the
application has no need to hide any of the data from me.
Even with this mechanism, there are work-arounds. That particular
company issues keys based on a registered account, but there are no
limitations registering. You just need a new email address, and since
it's trivial to generate a new email address any time you want, you can
always get a new key when the trial runs out.
But really, if you've got someone who is going that route to use your
product for free indefinitely, it's not all that likely that they'd pay
for the licensed version anyway. A better solution is to offer the
product at a reasonable price, so that otherwise-legitimate customers
aren't motivated to bypass a paid, retail license.
Pete