首先,在VB 6.0中建立一個ActiveX Dll工程項目,信息如下:
工程名稱:systimeset
類模塊名稱:timeset
VB 6.0的類模塊代碼如下:
1
Option Explicit
2
Private SystemTime As SystemTime
3
Private Declare Function SetSystemTime()Function SetSystemTime Lib "kernel32" (lpSystemTime As SystemTime) As Long
4
Private Type SystemTime
5
wYear As Integer
6
wMonth As Integer
7
wDayOfWeek As Integer
8
wDay As Integer
9
wHour As Integer
10
wMinute As Integer
11
wSecond As Integer
12
wMilliseconds As Integer
13
End Type
14
15
Dim tmp
16
17
Private m_Hour As Integer
18
Private m_Minute As Integer
19
Private m_Year As Integer
20
Private m_Month As Integer
21
Private m_Day As Integer
22
Private m_Second As Integer
23
24
'由李錫遠修改 修改日期:2006-08-31 修改項目:增加對年、月、日、秒的操作
25
'--------------------
26
'年
27
Public Property Get()Property Get Year() As Integer
28
Year = m_Year
29
End Property
30
Public Property Let()Property Let Year(tmp_Year As Integer)
31
m_Year = tmp_Year
32
End Property
33
'--------------------
34
'月
35