e-office

导航

限制软件30天试用

Dim ReValue As Date '声明时间变量 Dim name As String '声明字符串变量,软件名称 Dim dd As Variant '声明数值变量,dd为日期差 name = "gggg" '给变量赋值软件名为gggg ReValue = GetSetting(name, "MainKey", "DateValue", Date) '读取注册表软件名gggg的键值,如果没有则为当前日期 Me.Text1 = ReValue dd = DateDiff("d", ReValue, Date) '计算日期差 Me.Text2 = dd If dd = 0 Then '如果是第一天运行 SaveSetting name, "MainKey", "dateValue", Date '写注册表 End If If dd > 30 Then MsgBox "软件已过期" Else MsgBox "软件可以试用" 'DoCmd Quit MsgBox "还剩下" & 30 - dd & "天试用期!" End If

posted on 2008-05-07 00:20  matthew  阅读(396)  评论(0编辑  收藏  举报