VB Code:
Option Explicit
Dim RegDate As Date
Private Sub Form_Load()
'
' Read the registry to get the install date
'
RegDate = GetSetting("MyApp", "Licence", "InstallDate", 0)
If RegDate = 0 Then
'
' App hasn't been run before (on this machine)
' So write the current date & time to the registry
'
SaveSetting "MyApp", "Licence", "InstallDate", Now
Else
'
' Check whether more than 30 days has passed
'
If DateDiff("d", RegDate, Now) > 30 Then
MsgBox "This prog has expired"
End If
End If
End Sub
Note that this is very simple to bypass. You only need to either delete the registry entry or modify the date stored there for this code to be useless. It will work OK for non tech-savvy users though.