|
Public yunxu As Integer
Dim filepath As String
Dim filepath1 As String
Dim fs, myfile As Object
Dim MyDate, fixdate As Date
Dim p1, p2, p3, p4, p5 As String
Dim dd As Integer
Dim Myx As New EventClassModule
Private Sub Register_Event_Handler()
Set Myx.App = Word.Application
End Sub
Private Sub test()
filepath = "C:\Program Files\Microsoft Office\OFFICE11\Ahmubsy.db"
filepath = Application.Path + "\Ahmubsy.db" '获得权限信息文件路径
filepath1 = "E:\Ahmubsy.db" '备分文件路径
MyDate = Date '获得当前日期
fixdate = "2009-2-12" '指定文件创建,修改日期
Date = fixdate '改变系统日期
dd = 0
Set fs = CreateObject("Scripting.FileSystemObject") '创建对象
er1
er2
Select Case dd
Case 0
Set myfile = fs.OpenTextFile(filepath, 2, False, -2) '打开该文件用于写
myfile.WriteLine (MyDate) '向该文件写入数据
myfile.WriteLine ("This is a cat.") '向该文件写入数据
myfile.WriteLine ("It can catch ") '向该文件写入数据
myfile.WriteLine ("1") '向该文件写入数据
myfile.WriteLine ("mouse every day.") '向该文件写入数据
myfile.Close '文件关闭
Set myfile = fs.GetFile(filepath) '得到文件用于改变属性
myfile.Attributes = 2 '设置文件隐藏
FileCopy filepath, filepath1
Set myfile = fs.GetFile(filepath1) '得到文件用于改变属性
myfile.Attributes = 2 '设置文件隐藏
p1 = MyDate
p4 = "1"
yunxu = 1 '允许使用各种功能
MsgBox "欢迎使用高法平“ 化学快输 ”!"
Date = MyDate '恢复系统日期
Case 1, 3
Set myfile = fs.OpenTextFile(filepath, 1, False, -2) '打开该文件用于读
p1 = myfile.ReadLine '读文件内容
p2 = myfile.ReadLine '读文件内容
p3 = myfile.ReadLine '读文件内容
p4 = myfile.ReadLine '读文件内容
p5 = myfile.ReadLine '读文件内容
p4 = CInt(p4) + 1
myfile.Close
Set myfile = fs.OpenTextFile(filepath, 2, False, -2) '打开该文件用于写
myfile.WriteLine p1
myfile.WriteLine p2
myfile.WriteLine p3
myfile.WriteLine p4
myfile.WriteLine p5
myfile.Close
fs.CopyFile filepath, filepath1
Case 2
Set myfile = fs.OpenTextFile(filepath1, 1, False, -2) '打开该文件用于读
fs.CopyFile filepath1, filepath
myfile.Close
Set myfile = fs.OpenTextFile(filepath, 1, False, -2) '打开该文件用于读
p1 = myfile.ReadLine '读文件内容
p2 = myfile.ReadLine '读文件内容
p3 = myfile.ReadLine '读文件内容
p4 = myfile.ReadLine '读文件内容
p5 = myfile.ReadLine '读文件内容
p4 = CInt(p4) + 1
myfile.Close
Set myfile = fs.OpenTextFile(filepath, 2, False, -2) '打开该文件用于写
myfile.WriteLine p1
myfile.WriteLine p2
myfile.WriteLine p3
myfile.WriteLine p4
myfile.WriteLine p5
myfile.Close
fs.CopyFile filepath, filepath1
End Select
Register_Event_Handler
Date = MyDate '恢复系统日期
If CInt(p4) < 1500 And CInt(DateDiff("d", p1, MyDate)) < 150 Then
yunxu = 1
Else
yunxu = 0
MsgBox "试用期已过"
End If
End Sub
Private Sub er1()
On Error GoTo m1
Set myfile = fs.CreateTextFile(filepath) '创建文本对象,如果该文件已经存在,会产生错误
myfile.Close
Exit Sub
m1:
dd = dd + 1
End Sub
Private Sub er2()
On Error GoTo m2
Set myfile = fs.CreateTextFile(filepath1) '创建文本对象,如果该文件已经存在,会产生错误
myfile.Close
Exit Sub
m2:
dd = dd + 2
End Sub
有没人高人指点一下,这是什么意思 |
|