Link to home
Start Free TrialLog in
Avatar of tnt672397
tnt672397

asked on

TRIAL VERSION

I created an application using VB6 and I want users to only have access to running the program for only 15 days (15-Day Free Trial). Currently, I set up a regDate in a database..so when the current date is greater than the regDate +15, program is no longer accessible. However, if someone changes the date in the Date/Time settings, they can outfool the regDate. Also, by re-installing the program...you can get another 15-days.

So what I need is
Method on giving users only 15 days of running my program.
(1) User cannot get more access from program by uninstalling/reinstalling it (after 15 days)
(2) User cannot affect the program by changing the Date/Time settings

Who Can Help Me?
Avatar of ajaikumarr
ajaikumarr

Hai,

1. Instead of saving it on database use registry or encrypted text file inside system folder named something like "winfile.dll".

2. Add installed date on file/registry

3. Add an key of current date and update it day by day when the application starts. Check current date with this date so that the user can't change the system date if the system date is below this date inform the user that he had changed the date to some other date so that the app wont start and ask him to reset it to original date.

4. find the diffrence between current date and installed date, if it's above 15 days inform user that it's expired.

5. while installing your application check whether the reigstry/file exist already if it's dont overwite it.

Bye
Ajai
Avatar of tnt672397

ASKER

Ok sounds good, how do I create a text file in the winfile.dll?

Using VB6
Hai,

I've given sample to create a new file alone... just change the code to do encryption and overwrite it with current date.

Private Declare Function GetSystemDirectory Lib "kernel32" Alias "GetSystemDirectoryA" (ByVal lpBuffer As String, ByVal nSize As Long) As Long

Private Sub Command1_Click()
    Dim FileNum As Variant
    FileNum = FreeFile
    Open SystemDirectory() & "\WinFile.dll" For Append As #FileNum
    Print #FileNum, "InstalledDate = " & Now
    Print #FileNum, "CurrentDate = " & Now
    Close #FileNum
End Sub

Function SystemDirectory() As String
  Dim strSystemDirectory As String * 260
  GetSystemDirectory strSystemDirectory, 260
  SystemDirectory = TrimNulls(strSystemDirectory)
End Function

Private Function TrimNulls(ByVal strIn As String) As String
  Dim intPos As Integer
  intPos = InStr(strIn, vbNullChar)
  If intPos = 0 Then
    ' No nulls in the string, just return it as is
    TrimNulls = strIn
  Else
    If intPos = 1 Then
      ' If the null character is at the first position, the
      ' entire string is a null string, so return a zero-length string
      TrimNulls = ""
    Else
      ' Not at the first position, so return the contents up
      ' to the occurrence of the null character
      TrimNulls = Left$(strIn, intPos - 1)
    End If
  End If
End Function


Bye
Ajai
ASKER CERTIFIED SOLUTION
Avatar of ajaikumarr
ajaikumarr

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Try http://www.activelock.com/

They have an activex control for this. It may help you. Avoid storing information in the registry where you can, as its easily retrieved.