自己写的 软件注册的自定义函数
----------------------------------------------------------------
Dim yanshibig, yanshimini, wltime, rjtime, huoqusj, rjshiyongday, Y, Mon, D, xmlHttp, wzpingjie, insetl
Dim bdwltime,wjzhxg_time,is_wjzhxg_time,rjshiyong_time,iPath,siPath,wiPath
yanshibig=300
yanshimini = 50
//
lujinPath=true
rjzhuce(0, 3) = true
MessageBox \"wltime=\" & wltime & \" rjtime=\" & rjtime
If wltime > rjtime Then
Call Plugin.Msg.Tips(\"软件过期!!\")
MessageBox \"软件过期!!\"
Else
Call Plugin.Msg.Tips(\"软件可以使用!!\")
End If
EndScript
//自定义函数
//------------软件注册 软件验证 获取软件使用时间
Function rjzhuce(huoqusj,rjshiyongday)
//获取现在的网络时间
For 1
Call Plugin.Msg.Tips(\"获取网络时间!\")
Delay yanshimini
//
If huoqusj = 0 Then
// 本地
For 1
Y = Year(Date) : Mon = Month(Date) : D = Day(Date)
YJ = Y & \"-\" & Mon & \"-\" & D
YJ = Replace(YJ, \"-0\", \"-\")
Delay yanshimini
Next
ElseIf huoqusj = 1 Then
// 网络1
For 0
Set xmlHttp = CreateObject(\"Microsoft.XMLHTTP\")
Delay yanshimini
xmlHttp.Open \"get\", \"http://m.hao123.com/1234\", False
xmlHttp.send
Delay yanshimini
sdate = ucase(xmlhttp.getResponseHeader(\"Date\"))
Set xmlHttp = nothing
Delay yanshimini
YJ = cdate(trim(mid(sdate, 5, instr(sdate, \"GMT\") - 6))) + 8 / 24
Delay yanshimini
YJ = Mid(YJ, 1, 10)
YJ = Replace(YJ, \"-0\", \"-\")
Delay yanshimini
Next
// 网络2
For 1
// 清理缓存
Call Plugin.Web.ClearHistory()
Call Plugin.Web.ClearTemp()
Call Plugin.Web.ClearCookie()
//
wzpingjie = \"http://www.tjheer.cn\"
wzpingjie = wzpingjie & \"/khzl.asp\"
YJ = Lib.网络.获得网页源文件(wzpingjie)
Delay yanshibig * 2
adfdf = \"<!--xitongshijian-->[\"
insetl = InStr(YJ, adfdf)
// MessageBox insetl
Delay yanshimini
If insetl <= 0 Then
MessageBox \"不通过!获取软件使用时间失败!请联系开发者!!!!\"
EndScript
End If
YJ = Mid(YJ, insetl + 21, 10)
YJ = Replace(YJ, \"-0\", \"-\")
YJ = Replace(YJ, \" \", \"\")
Delay yanshibig
//MessageBox YJ
Next
Else
End If
Call Plugin.Msg.Tips(YJ)
Delay yanshimini
Next
//获取软件使用时间
For 1
bdwltime = Plugin.File.ReadINI(\"Command\", \"wltime\", siPath)//1
wltime = YJ //2
//读取同步是的文件修改时间
wjzhxg_time = Plugin.File.ReadINI(\"Command\", \"wjzhxg_time\", iPath) //3
//{
//获取现在的文件修改时间
is_wjzhxg_time = Plugin.lxj_Plug.lxj_GetFileTime(siPath, 3)
is_wjzhxg_time = Replace(is_wjzhxg_time, \"-0\", \"-\")
is_wjzhxg_time = Replace(is_wjzhxg_time, \"-\", \"\")
is_wjzhxg_time = Replace(is_wjzhxg_time, \":\", \"\")
is_wjzhxg_time = Replace(is_wjzhxg_time, \" \", \"\")// 4
//}
MessageBox \" 本存时间=\"&bdwltime&vbcrlf&\" 网络时间=\" &wltime&vbcrlf&\" 同步时文件最后修改的时间=\"&wjzhxg_time&vbcrlf&\" 现在的文件最后修改的时间=\"&is_wjzhxg_time
Delay yanshimini
If bdwltime <> wltime or wjzhxg_time <> is_wjzhxg_time Then
If huoqusj = 0 Then
// 本地
For 1
// 本地时间,只能试用!!
rjshiyong_time = Plugin.File.ReadINI(\"Command\", \"rjshiyong_time\", wiPath)
// MessageBox \"取出rjshiyong_time=\"&rjshiyong_time
If rjshiyong_time = \"\" Then
Call Plugin.File.WriteINI(\"Command\", \"rjshiyong_time\", \"1\", wiPath)
// MessageBox \"是空就赋值1\"
Delay yanshimini
rjtime = DateAdd(\"d\", + rjshiyongday , wltime)
Delay yanshibig*2
// MessageBox \"你选的是本地时间,只能试用到 \" & rjtime
rjtime = Replace(rjtime, \"-0\", \"-\")
Delay yanshibig
//保存软件使用时间
Call Plugin.File.WriteINI(\"Command\", \"rjtime\", rjtime, siPath)
Delay yanshibig*2
rjtime = Plugin.File.ReadINI(\"Command\", \"rjtime\", siPath)
Delay yanshibig
End If
// MessageBox rjtime
If rjtime <> \"\" Then
//保存今天的网络时间
Call Plugin.File.WriteINI(\"Command\", \"wltime\", wltime, siPath)
Delay yanshimini
End If
//保存文件最后修改时间
wjzhxg_time = Plugin.lxj_Plug.lxj_GetFileTime(siPath, 3)
wjzhxg_time = Replace(wjzhxg_time, \"-0\", \"-\")
Delay yanshimini
//MessageBox \"最后修改的时间=\" & wjzhxg_time
wjzhxg_time = Replace(wjzhxg_time, \"-\", \"\")
wjzhxg_time = Replace(wjzhxg_time, \":\", \"\")
wjzhxg_time = Replace(wjzhxg_time, \" \", \"\")
//MessageBox wjzhxg_time
Call Plugin.File.WriteINI(\"Command\", \"wjzhxg_time\", wjzhxg_time, iPath)
Delay yanshimini
If rjshiyong_time <> \"\" Then
//保存今天的网络时间
Call Plugin.File.WriteINI(\"Command\", \"wltime\", wltime, siPath)
//保存文件最后修改时间
wjzhxg_time = Plugin.lxj_Plug.lxj_GetFileTime(siPath, 3)
wjzhxg_time = Replace(wjzhxg_time, \"-0\", \"-\")
wjzhxg_time = Replace(wjzhxg_time, \"-\", \"\")
wjzhxg_time = Replace(wjzhxg_time, \":\", \"\")
wjzhxg_time = Replace(wjzhxg_time, \" \", \"\")
//MessageBox wjzhxg_time
Call Plugin.File.WriteINI(\"Command\", \"wjzhxg_time\", wjzhxg_time, iPath)
Delay yanshimini
rjshiyong_time = Plugin.File.ReadINI(\"Command\", \"rjshiyong_time\", wiPath)
Call Plugin.Msg.Tips(\"第\" & rjshiyong_time & \"次试用!!\")
// MessageBox \"第\" & rjshiyong_time & \"次试用!!\"
If rjshiyong_time > rjshiyongday Then
MessageBox \"试用结束!!!\"
EndScript
End If
rjshiyong_time = rjshiyong_time + 1
Call Plugin.File.WriteINI(\"Command\", \"rjshiyong_time\", rjshiyong_time, wiPath)
Delay yanshibig
// EndScript
End If
Next
ElseIf huoqusj = 1 Then
// 网络
For 1
Call Plugin.Msg.Tips(\"正在同步时间!!!!\")
// 清理缓存
Call Plugin.Web.ClearHistory()
Call Plugin.Web.ClearTemp()
Call Plugin.Web.ClearCookie()
//
wzpingjie = \"http://www.tjheer.cn\"
wzpingjie = wzpingjie & \"/khzl.asp\"
rjtime = Lib.网络.获得网页源文件(wzpingjie)
Delay yanshibig*2
//adfdf = \"<td align=\"\"center\"\">1[\"
adfdf = \"<td align=\"\"center\"\">2[\"
insetl = InStr(rjtime, adfdf)
//MessageBox insetl
Delay yanshimini
If insetl <= 0 Then
MessageBox \"不通过!获取软件使用时间失败!请联系开发者!!!!\"
EndScript
End If
rjtime = Mid(rjtime, insetl + 21, 10)
rjtime = Replace(rjtime, \"-0\", \"-\")
Delay yanshibig
//保存软件使用时间
Call Plugin.File.WriteINI(\"Command\", \"rjtime\", rjtime, siPath)
Delay yanshibig
rjtime = Plugin.File.ReadINI(\"Command\", \"rjtime\", siPath)
Delay yanshibig
If rjtime <> \"\" Then
//保存今天的网络时间
Call Plugin.File.WriteINI(\"Command\", \"wltime\", wltime, siPath)
Delay yanshimini
End If
//保存文件最后修改时间
wjzhxg_time = Plugin.lxj_Plug.lxj_GetFileTime(siPath, 3)
wjzhxg_time = Replace(wjzhxg_time, \"-0\", \"-\")
Delay yanshimini
//MessageBox \"最后修改的时间=\" & wjzhxg_time
wjzhxg_time = Replace(wjzhxg_time, \"-\", \"\")
wjzhxg_time = Replace(wjzhxg_time, \":\", \"\")
wjzhxg_time = Replace(wjzhxg_time, \" \", \"\")
//MessageBox wjzhxg_time
Call Plugin.File.WriteINI(\"Command\", \"wjzhxg_time\", wjzhxg_time, iPath)
Next
Call Plugin.Msg.Tips(rjtime)
End If
End If
//取出 软件使用时间 和 今天的网络时间
rjtime = Plugin.File.ReadINI(\"Command\", \"rjtime\", siPath)
wltime = Plugin.File.ReadINI(\"Command\", \"wltime\", siPath)
Delay yanshimini
Next
End Function
//------------获取路径
Function lujinPath
//ben
iPath = Plugin.SysEx.GetDir(0)
iPath = iPath & \"\\Configth.ini\"
Delay yanshimini
//ben
siPath = Plugin.SysEx.GetDir(0)
siPath = siPath & \"\\Configth4.ini\"
Delay yanshimini
//windows
wiPath = Plugin.SysEx.GetDir(2)
wiPath = wiPath & \"\\Configth4.ini\"
Delay yanshimini
End Function