|
-
Jan 6th, 2004, 12:57 AM
#1
Thread Starter
Lively Member
Demo application
1. How to make my application to work only for 30 days i.e., as an demo application
2. How to make my application to run only one instance?
S.Desikan
-
Jan 6th, 2004, 01:18 AM
#2
-= B u g S l a y e r =-
good morning desi_in 
2. How to make my application to run only one instance?
VB Code:
Private Sub Form_Load()
If App.PrevInstance = True Then
AppActivate "AppName"
Unload Me
End If
End Sub
-
Jan 6th, 2004, 01:19 AM
#3
-= B u g S l a y e r =-
here is a sample on how to protect your app. Its not the best protection, but it should get you started 
VB Code:
Option Explicit
Public Function DateGood(NumDays As Integer) As Boolean
'The purpose of this module is to allow you to place a time
'limit on the unregistered use of your shareware application.
'This module can not be defeated by rolling back the system clock.
'Simply call the DateGood function when your application is first
'loading, passing it the number of days it can be used without
'registering.
'
'Ex: If DateGood(30)=False Then
' CrippleApplication
' End if
'Register Parameters:
' CRD: Current Run Date
' LRD: Last Run Date
' FRD: First Run Date
Dim TmpCRD As Date
Dim TmpLRD As Date
Dim TmpFRD As Date
TmpCRD = Format(Now, "m/d/yy")
TmpLRD = GetSetting(App.EXEName, "Param", "LRD", "1/1/2000")
TmpFRD = GetSetting(App.EXEName, "Param", "FRD", "1/1/2000")
DateGood = False
'If this is the applications first load, write initial settings
'to the register
If TmpLRD = "1/1/2000" Then
SaveSetting App.EXEName, "Param", "LRD", TmpCRD
SaveSetting App.EXEName, "Param", "FRD", TmpCRD
End If
'Read LRD and FRD from register
TmpLRD = GetSetting(App.EXEName, "Param", "LRD", "1/1/2000")
TmpFRD = GetSetting(App.EXEName, "Param", "FRD", "1/1/2000")
If TmpFRD > TmpCRD Then 'System clock rolled back
DateGood = False
ElseIf Now > DateAdd("d", NumDays, TmpFRD) Then 'Expiration expired
DateGood = False
ElseIf TmpCRD > TmpLRD Then 'Everything OK write New LRD date
SaveSetting App.EXEName, "Param", "LRD", TmpCRD
DateGood = True
ElseIf TmpCRD = Format(TmpLRD, "m/d/yy") Then
DateGood = True
Else
DateGood = False
End If
End Function
'Usage
Private Sub Form_Activate()
If Not DateGood(30) Then
MsgBox "Trial Period Expired!", vbExclamation, "Unregistered application"
Unload Me
End If
End Sub
-
Dec 16th, 2004, 03:03 PM
#4
Member
Re: Demo application
Ok.. correct me if I wrong. But, I tried this code.. and then went into my registry... HKEY_CURRENT_USER\Software\VB and VBA Program Settings, and I find the program name with FRD and LRD (First Run Date, Last Run Date) sitting right there.. with the actual dates in them. So.. using this method, wouldn't one just have to change the date to beat this code? I've never done any registry work.. so I'm just trying to understand it.
Thx all!
-
Dec 16th, 2004, 03:13 PM
#5
Re: Demo application
I would encrypt the dates, and make the reg keys names a bit more obscure. You could also use the registry APIs to store the info in different place in the registry.
Tg
-
Dec 16th, 2004, 03:15 PM
#6
Re: Demo application
 Originally Posted by jolene_keagy
.... wouldn't one just have to change the date to beat this code?
No doubt. As peet mentioned its a demo and not the best protection. However, I't
may give you a place to start. What you can now do is use some 'encryption' alorithim
to save out the date and decoded when read back in for validation.
Bruce.
-
Dec 16th, 2004, 04:16 PM
#7
Member
Re: Demo application
thx all!
Jolene
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|