Private Sub Expire_Project()
str = GetSetting("HKey_Lib_Main", "Exp_Classes", "INTValue") 'First Get the Value from the Registry
If Len(Trim(str)) < 1 Then 'If the Registry Value is not set then Set the Value
Call Convert_Into_Letters(Format(Date, "dd-mm-yyyy")) 'Convert Digits into Letters
SaveSetting "HKey_Lib_Main", "Exp_Classes", "INTValue", StartDate
expDate = DateAdd("d", 15, Date) 'Add 15 days to the Current Date
Call Convert_Into_Letters(Format(expDate, "dd-mm-yyyy")) 'Convert Digits into Letters
SaveSetting "HKey_Lib_Main", "Exp_Classes", "EXPValue", StartDate 'Here I have Given 15 days for expiration of the Software You can Give 'n' no of days as you like
Else
str1 = GetSetting("HKey_Lib_Main", "Exp_Classes", "USD") 'If this Registry Value is not Set then
If Len(Trim(str1)) < 1 Then
str = GetSetting("HKey_Lib_Main", "Exp_Classes", "INTValue") 'Get the Previously set Initial Value from the Registry
Call Convert_Into_Digits(str) 'Convert Letters Into Digits
initialDate = CDate(ExpiryDate)
str2 = GetSetting("HKey_Lib_Main", "Exp_Classes", "EXPValue") 'Get the Exp_Classes Value from the Registry
Call Convert_Into_Digits(str2) 'Convert Letters Into Digits
expDate = CDate(ExpiryDate)
If Date > expDate Or Date < initialDate Then 'Compare Registry Values with the Date, if they are bound with in the Initial Value of the Software and Exp_Classes Value of the SOftware then only the Program will run
SaveSetting "HKey_Lib_Main", "Exp_Classes", "USD", "True" 'Now set the USD value to True
MsgBox "Software Has Been Expired; You cannot run the Software by Setting the Date Backwards", vbExclamation, "Software Expired"
Expire = True
Exit Sub
End If
Else
MsgBox "Software Has Been Expired; You cannot run the Software by Setting the Date Backwards", vbExclamation, "Software Expired"
Expire = True
Exit Sub
End If
End If
End Sub
Private Sub Convert_Into_Letters(ByVal SDate As String)
StoreDate = Format(SDate)
StartDate = ""
If Len(StoreDate) > 0 Then
For I = 1 To Len(StoreDate)
Select Case Mid(StoreDate, I, 1)
Case 1: StartDate = StartDate + "F"
Case 2: StartDate = StartDate + "L"
Case 3: StartDate = StartDate + "A"
Case 4: StartDate = StartDate + "Z"
Case 5: StartDate = StartDate + "K"
Case 6: StartDate = StartDate + "T"
Case 7: StartDate = StartDate + "H"
Case 8: StartDate = StartDate + "V"
Case 9: StartDate = StartDate + "P"
Case 0: StartDate = StartDate + "X"
Case "/": StartDate = StartDate + "Q"
Case "-": StartDate = StartDate + "J"
Case "\": StartDate = StartDate + "N"
End Select
Next
End If
End Sub
Private Sub Convert_Into_Digits(ByVal StartDate As String)
ExpiryDate = ""
If Len(StartDate) > 0 Then
For I = 1 To Len(StartDate)
Select Case Mid(StartDate, I, 1)
Case "F": ExpiryDate = ExpiryDate + "1"
Case "L": ExpiryDate = ExpiryDate + "2"
Case "A": ExpiryDate = ExpiryDate + "3"
Case "Z": ExpiryDate = ExpiryDate + "4"
Case "K": ExpiryDate = ExpiryDate + "5"
Case "T": ExpiryDate = ExpiryDate + "6"
Case "H": ExpiryDate = ExpiryDate + "7"
Case "V": ExpiryDate = ExpiryDate + "8"
Case "P": ExpiryDate = ExpiryDate + "9"
Case "X": ExpiryDate = ExpiryDate + "0"
Case "Q": ExpiryDate = ExpiryDate + "/"
Case "J": ExpiryDate = ExpiryDate + "-"
Case "N": ExpiryDate = ExpiryDate + "\"
End Select
Next
End If
End Sub