Yesterday a friend had a need to modify the time on the IIS server through the Web, because his system was developed under ASP 3.0, so the code for this example is ASP, Not asp.net, but I write this article is to make a note, after all, writing program is not the key to language, more important is a thought, the process of language as a tool to understand programming thinking as a solution to the problem of ideas and methods, then write the program is: the use of "tools" according to solve the problem of the idea "To solve a problem.
First of all, to thank netizens "Tiger", I read on the Internet he wrote an article on VB 6.0 to write DLL components for ASP's article rewrite, his DLL code only to achieve the rewrite hours and minutes, I increased the year, month, day, second modification.
First of all, in VB 6.0 to establish an ActiveX DLL project, the information is as follows:
Project Name: Systimeset
class module Name: Timeset
VB 6.0 class module code is as follows:
1Option Explicit
2Private SystemTime as SystemTime
3Private Declare function SetSystemTime () function SetSystemTime Lib "kernel32" (Lpsystemtime as SystemTime) as Long
4Private Type SystemTime
5 Wyear as Integer
6 Wmonth as Integer
7 Wdayofweek as Integer
8 Wday as Integer
9 Whour as Integer
Ten Wminute as Integer
One Wsecond as Integer
Wmilliseconds as Integer
13End Type
14
15Dim tmp
16
17Private M_hour as Integer
18Private M_minute as Integer
19Private M_year as Integer
20Private M_month as Integer
21Private M_day as Integer
22Private M_second as Integer
23
24 ' Modified by Li Xiyuan Modification Date: 2006-08-31 Modify item: Increase the operation of year, month, day, and second
'--------------------
26 ' Year
27Public Property Get () Property Get year () as Integer
28Year = M_year
29End Property
30Public Property Let (Tmp_year as Integer)
31m_year = Tmp_year
32End Property
'--------------------
34 ' Month
35Public Property Get () Property Get Month () as Integer
36Month = M_month
37End Property
38Public Property Let-let Month (Tmp_month as Integer)
39m_month = Tmp_month
40End Property
'--------------------
42 ' Day
43Public Property Get () as Integer
44Day = M_day
45End Property
46Public Property Let (Tmp_day as Integer)
47m_day = Tmp_day
48End Property
'--------------------
50 ' sec
51Public Property Get () Property Get Second () as Integer
52Second = M_second
53End Property
54Public Property Let-let Second (Tmp_second as Integer)
55m_second = Tmp_second
56End Property
57
58
59
60Public Property Get () Property Get Hour () as Integer
61Hour = M_hour
62End Property
63Public Property Let-let Hour (Tmp_hour as Integer)
64m_hour = Tmp_hour
65End Property
66Public Property Get () Property Get Minute () as Integer
67Minute = M_minute
68End Property
69Public Property Let-let Minute (Tmp_minute as Integer)
70m_minute = Tmp_minute
71End Property
72
73
74
75
76Public function Setup () function setup () as Integer
77systemtime.wday = Day
The ' 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