应gebobo (波波) 的要求,先贴软件试用期代码如下:(谢绝转载) Private Sub Main() On Error GoTo ERRORIf App.PrevInstance = True Then MsgBox "本系统已经启动!请查看任务栏!", 48, gth End End If '试用期的程序If Dir("c:\windows\sysbckup\date.mdb") = "" Then Dim WS As Workspace Dim DB As Database Dim TD As TableDef Dim FLD As Field Dim IDX As Index Dim rd As Recordset Set WS = DBEngine.Workspaces(0) Set DB = WS.CreateDatabase("c:\windows\sysbckup\date.mdb", dbLangGeneral) DB.Connect = ";pwd=SPRINGLOVER" Set TD = DB.CreateTableDef("date") TD.Attributes = 0 TD.Connect = "" TD.SourceTableName = "" TD.ValidationRule = "" TD.ValidationText = "" ' Field first_time Set FLD = TD.CreateField("first_time", 8, 8) FLD.Attributes = 1 FLD.DefaultValue = "" FLD.OrdinalPosition = 0 FLD.Required = False FLD.ValidationRule = "" FLD.ValidationText = "" TD.Fields.Append FLD ' Field last_time Set FLD = TD.CreateField("last_time", 8, 8) FLD.Attributes = 1 FLD.DefaultValue = "" FLD.OrdinalPosition = 1 FLD.Required = False FLD.ValidationRule = "" FLD.ValidationText = "" TD.Fields.Append FLD ' Field times Set FLD = TD.CreateField("times", 3, 2) FLD.Attributes = 1 FLD.DefaultValue = "" FLD.OrdinalPosition = 2 FLD.Required = False FLD.ValidationRule = "" FLD.ValidationText = "" TD.Fields.Append FLD DB.TableDefs.Append TD DB.Close Set DB = WS.OpenDatabase("c:\windows\sysbckup\date.mdb") ', pwd = "SPRINGLOVER") Set rd = DB.OpenRecordset("date") With rd .AddNew .Fields("first_time") = Date .Fields("last_time") = Date .Fields("times") = 1 .Update End With DB.Close MsgBox "这是您第一次启动本系统!您的试用期为1000天,今天是第一天.谢谢使用!", 48, "天华电脑艺术创意工作室" mainform.Show '启动您的主窗体 Else Dim WS2 As Workspace Dim DB2 As Database Dim rd2 As Recordset Set WS2 = Workspaces(0) Set DB2 = WS2.OpenDatabase("c:\windows\sysbckup\date.mdb", pwd = "SPRINGLOVER") Set rd2 = DB2.OpenRecordset("date") '开始检测用户是否修改了系统日期 If Not (rd2.EOF And rd2.BOF) Then rd2.MoveFirst End If If rd2.Fields("last_time") > Date Then MsgBox "对不起,您在本软件的试用期内不可以修改系统日期,否则将取消您对不系统的试用权.如果您想继续使用本软件,请您恢复系统日期.谢谢合作!", 48, "天华电脑艺术创意工作室" End End If '开始检测是否超期 If Date - rd2.Fields("first_time") >= 1000 Then '设定试用期为1000天 MsgBox "您已经启动本系统" & rd2.Fields("times") & "次了,而且已经到了1000天的试用期,如果您想继续使用本软件,请您到本公司注册并购买正版的软件!", 48, "天华电脑艺术创意工作室" End Else '仍在试用期内 Num% = rd2.Fields("times") rd2.Edit rd2.Fields("last_time") = Date rd2.Fields("times") = Num + 1 rd2.Update MsgBox "这是您第" & rd2.Fields("times") & "次使用本系统,您还有" & 1000 - (Date - rd2.Fields("first_time")) & "天的试用期,祝您今天工作愉快!", 48, "天华电脑艺术创意工作室" mainform.Show '启动您的主窗体 End If End Iffrmback.ShowExit Sub ERROR: MsgBox "系统错误!启动失败!" End Sub
Private Sub Main()
On Error GoTo ERRORIf App.PrevInstance = True Then
MsgBox "本系统已经启动!请查看任务栏!", 48, gth
End
End If
'试用期的程序If Dir("c:\windows\sysbckup\date.mdb") = "" Then
Dim WS As Workspace
Dim DB As Database
Dim TD As TableDef
Dim FLD As Field
Dim IDX As Index
Dim rd As Recordset
Set WS = DBEngine.Workspaces(0)
Set DB = WS.CreateDatabase("c:\windows\sysbckup\date.mdb", dbLangGeneral)
DB.Connect = ";pwd=SPRINGLOVER"
Set TD = DB.CreateTableDef("date")
TD.Attributes = 0
TD.Connect = ""
TD.SourceTableName = ""
TD.ValidationRule = ""
TD.ValidationText = ""
' Field first_time
Set FLD = TD.CreateField("first_time", 8, 8)
FLD.Attributes = 1
FLD.DefaultValue = ""
FLD.OrdinalPosition = 0
FLD.Required = False
FLD.ValidationRule = ""
FLD.ValidationText = ""
TD.Fields.Append FLD
' Field last_time
Set FLD = TD.CreateField("last_time", 8, 8)
FLD.Attributes = 1
FLD.DefaultValue = ""
FLD.OrdinalPosition = 1
FLD.Required = False
FLD.ValidationRule = ""
FLD.ValidationText = ""
TD.Fields.Append FLD
' Field times
Set FLD = TD.CreateField("times", 3, 2)
FLD.Attributes = 1
FLD.DefaultValue = ""
FLD.OrdinalPosition = 2
FLD.Required = False
FLD.ValidationRule = ""
FLD.ValidationText = ""
TD.Fields.Append FLD
DB.TableDefs.Append TD
DB.Close
Set DB = WS.OpenDatabase("c:\windows\sysbckup\date.mdb") ', pwd = "SPRINGLOVER")
Set rd = DB.OpenRecordset("date")
With rd
.AddNew
.Fields("first_time") = Date
.Fields("last_time") = Date
.Fields("times") = 1
.Update
End With DB.Close
MsgBox "这是您第一次启动本系统!您的试用期为1000天,今天是第一天.谢谢使用!", 48, "天华电脑艺术创意工作室"
mainform.Show '启动您的主窗体
Else
Dim WS2 As Workspace
Dim DB2 As Database
Dim rd2 As Recordset
Set WS2 = Workspaces(0)
Set DB2 = WS2.OpenDatabase("c:\windows\sysbckup\date.mdb", pwd = "SPRINGLOVER")
Set rd2 = DB2.OpenRecordset("date")
'开始检测用户是否修改了系统日期
If Not (rd2.EOF And rd2.BOF) Then
rd2.MoveFirst
End If
If rd2.Fields("last_time") > Date Then
MsgBox "对不起,您在本软件的试用期内不可以修改系统日期,否则将取消您对不系统的试用权.如果您想继续使用本软件,请您恢复系统日期.谢谢合作!", 48, "天华电脑艺术创意工作室"
End
End If
'开始检测是否超期
If Date - rd2.Fields("first_time") >= 1000 Then '设定试用期为1000天
MsgBox "您已经启动本系统" & rd2.Fields("times") & "次了,而且已经到了1000天的试用期,如果您想继续使用本软件,请您到本公司注册并购买正版的软件!", 48, "天华电脑艺术创意工作室" End Else
'仍在试用期内
Num% = rd2.Fields("times")
rd2.Edit
rd2.Fields("last_time") = Date
rd2.Fields("times") = Num + 1
rd2.Update MsgBox "这是您第" & rd2.Fields("times") & "次使用本系统,您还有" & 1000 - (Date - rd2.Fields("first_time")) & "天的试用期,祝您今天工作愉快!", 48, "天华电脑艺术创意工作室"
mainform.Show '启动您的主窗体
End If
End Iffrmback.ShowExit Sub
ERROR:
MsgBox "系统错误!启动失败!"
End Sub