一般方法: 1、在程序第一次起动的时候,将起动的时间写入一个特定的地方,比如说文件,注册表等等(恶搞:如果你能力还可以写入磁盘底层保护区域)。 2、在以后的程序启动过程中: if 注册=OK then 正常起动 else if 过期校检=未过期 then 起动体验方式 else 终止程序 endif end if
加网络功能,即校检Internet时间。 如果只单单在本地,下面的方只能作到用一段时间就少一段时间的效果。1、控件TIMER 每隔一段时间就与入一个时间 2、过期校检 读取 最后一次写入的时间 IF 最后一次写入的时间 > 安装时间 + 可使用的时间 then 返回过期 else if 最后一次写入的时间 >现在的时间 then 返回过期 else 返回未过期 end if end if
'以下确定windows路径 Const MAX_PATH = 260 Private Declare Function GetWindowsDirectory Lib "kernel32" Alias "GetWindowsDirectoryA" (ByVal lpBuffer As String, ByVal nSize As Long) As Long '核对程序是否合法地在试用期内运行 Dim fs, f, f1, fc Set fs = CreateObject("Scripting.FileSystemObject") Set f = fs.GetFolder(GetWinPath) Set fc = f.Files For Each f1 In fc If CDate(f1.DateLastModified) >= CDate("2006-11-5") Then msg = MsgBox("该软件的试用到期日为2006年11月5日。" & Chr(13) & "如果您看到此信息,表示该系统的使用权限已过期!" & Chr(13) & "请与系统管理员联系。", vbOKOnly + vbExclamation) End End If Next 我就是用这种方式控制软件的试用期,检查windows临时文件的日期,更改系统日期无效!
1、在程序第一次起动的时候,将起动的时间写入一个特定的地方,比如说文件,注册表等等(恶搞:如果你能力还可以写入磁盘底层保护区域)。
2、在以后的程序启动过程中:
if 注册=OK then
正常起动
else
if 过期校检=未过期 then
起动体验方式
else
终止程序
endif
end if
如果只单单在本地,下面的方只能作到用一段时间就少一段时间的效果。1、控件TIMER 每隔一段时间就与入一个时间
2、过期校检
读取 最后一次写入的时间
IF 最后一次写入的时间 > 安装时间 + 可使用的时间 then
返回过期
else
if 最后一次写入的时间 >现在的时间 then
返回过期
else
返回未过期
end if
end if
每次启动前,程序计算注册码是否有效
无效则进入试用功能
Const MAX_PATH = 260
Private Declare Function GetWindowsDirectory Lib "kernel32" Alias "GetWindowsDirectoryA" (ByVal lpBuffer As String, ByVal nSize As Long) As Long
'核对程序是否合法地在试用期内运行
Dim fs, f, f1, fc
Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.GetFolder(GetWinPath)
Set fc = f.Files
For Each f1 In fc
If CDate(f1.DateLastModified) >= CDate("2006-11-5") Then
msg = MsgBox("该软件的试用到期日为2006年11月5日。" & Chr(13) & "如果您看到此信息,表示该系统的使用权限已过期!" & Chr(13) & "请与系统管理员联系。", vbOKOnly + vbExclamation)
End
End If
Next
我就是用这种方式控制软件的试用期,检查windows临时文件的日期,更改系统日期无效!