Const REG_CODE = "111-111-111-111"
'实际能使用的次数加1
Const TRY_TIMES = 101
Dim CnnOpened As Boolean
Dim db As DAO.Database
Dim m_IsRegister As Boolean
Dim LeftTimes As Integer
Dim USED As Boolean
Property Let IsRegister(nValue As Boolean)
m_IsRegister = nValue
End Property
Private Sub ReNewReg()
DeleteProperty db, RegName
DeleteProperty db, RegCop
SetProperty db, "Registered", dbBoolean, False
SetProperty db, "LeftTimes", dbInteger, TRY_TIMES
End Sub
Private Sub cmdOk_Click()
If Not m_IsRegister Then USED = True
Unload Me
End Sub
Private Sub cmdReg_Click()
If txtName = "" Then
MsgBox "必须输入名字!", vbCritical, "错误"
txtName.SetFocus
Exit Sub
End If
If txtCop = "" Then
MsgBox "必须输入公司!", vbCritical, "错误"
txtCop.SetFocus
Exit Sub
End If
If Len(txtCop) * 2 <> LenB(StrConv(txtCop, vbFromUnicode)) Then
MsgBox "公司名字请用中文!", vbCritical, "错误"
txtCop.SetFocus
SendKeys "{HOME}+{END}"
Exit Sub
End If
If txtCode <> REG_CODE Then
MsgBox "注册码错误!", vbCritical, "错误"
txtCode.SetFocus
SendKeys "{HOME}+{END}"
Exit Sub
End If
Registered = True
RegName = txtName.Text
RegCop = txtCop.Text
SetProperty db, "Registered", dbBoolean, True
SetProperty db, "RegName", dbText, txtName.Text
SetProperty db, "RegCop", dbText, txtCop.Text
MsgBox "恭喜您,注册成功!", vbExclamation, "提示"
USED = True
Unload Me
End Sub