作者:动态网站…
来源:动态网站制作指南
热度:
2006-10-5 14:04:45
74
75
76Public Function setup()Function setup() As Integer
77SystemTime.wDay = Day
78'SystemTime.wDayOfWeek = 1
79SystemTime.wMilliseconds = 0
80SystemTime.wMonth = Month
81SystemTime.wSecond = Second
82SystemTime.wYear = Year
83SystemTime.wHour = Hour
84SystemTime.wMinute = Minute
85setup = SetSystemTime(SystemTime)
86
87End Function
88
将其编译为systimeset.dll的文件。
关于DLL的注册,通常VB在本机上编译后,会自动将DLL注册;但如果你要放到IIS服务器上,请使用如下方法:
1、将systimeset.dll拷贝到c:\WINDOWS\system32下;
2、在开始菜单的运行里面输入:regsvr32 systimeset.dll (敲回车啊)
3、因为修改服务器的时间,INTERNET来宾帐户不具有该权限,设立权限请打开控制面版中的“管理工具”,然后打开“本地安全策略”--“用户权力指派”,双击“更改系统时间”,在弹出的对话框中点“添加用户或组”,将INETNET来宾帐户加入进来。
4、一切完毕后,将IIS服务重新启动一次。
在上面的设置完毕后,使用systimeset.dll组件的ASP代码页面如下:
1<% @language="vbscript" %>
2<%
3function SetTime(strYear,strMonth,strDay)
4response.Expires=0
5set obj=server.createobject("systimeset.timeset")
6 obj.Year=strYear
7 obj.Month=strMonth
8 obj.Day=strDay
9 if Hour(now())-8>0 then
10 obj.Hour=Hour(now())-8
11 else
12 obj.Hour=8
13 end if
14 obj.Minute=Minute(now())
15 obj.Second=Second(now())
16 obj.setup
17
18set obj=Nothing
19end function
20
21if request("act")="modi" then
22 call SetTime(request.Form("strYear"),request.Form("strMonth"),request.Form
23
24("strDay"))
25end if
26%>
27<form id="form1" name="form1" method="post" action="?act=modi">
28 <table width="290" border="0">
29 <tr>
30 <td width="77"><input name="strYear" type="text" id="strYear" value="<%=Year(now())%>"
31
32size="8" /></td>
33 <td width="49"><input name="strMonth" type="text" id="strMonth" value="<%=Month(now
34
35())%>" size="5" /></td>
36 <td width="48"><input name="strDay" type="text" id="strDay" value="<%=Day(now())%>"
37
38size="5" /></td>
39 <td width="98"><input type="submit" name="Submit" value="修改日期" /></td>
40 </tr>
41 </table>
42</form>
43
以上是所有实现的代码,有问题可以加我QQ:17020415
将上面的ASP代码页面粘贴到一个空的ASP文件中,然后在IIS中将站点设置好就可以了。(设置IIS虚拟目录也可以的。)
http://www.cnblogs.com/lixyvip/archive/2006/09/02/492693.html
我来说两句:
推荐文章
相关文章