Private Sub Command1_Click() Dim s As String s = InputBox("请输入密文:", "输入密文") If Len(s) > 0 Then s = decode_reduce3(s) MsgBox "原密码是:" & s End If End Sub '解密函数,在 加密控制类 中。包括加密函数都在。 Public Function decode_reduce3(ByVal the_txt As String) As String Dim num1& Dim char2$ Dim char3$ Dim i As Long For i = 1 To Len(the_txt) num1 = Asc(Mid(the_txt, i, 1)) num1 = num1 - 4 char2 = Chr(num1) char3 = char3 & char2 Next i decode_reduce3 = char3 End Function
Private DB As ADODB.Connection
Private Rs As ADODB.Recordset
Private Sub Command1_Click()
Dim i As Integer
For i = 1 To Rs.RecordCount
Rs.AbsolutePosition = i
If Trim(Rs("name")) = Text1.Text And Trim(Rs("password")) = Text2.Text Then
Form2.Show
Unload Form1
Exit For
Else
If i = Rs.RecordCount Then
MsgBox "用户与密码不正确,请重新输入", , "登录"
Command2_Click
End If
End If
Next
End Sub
Private Sub Command2_Click()
Text1.Text = ""
Text2.Text = ""
Text1.SetFocus
End Sub
Private Sub Command3_Click()
End
End Sub
Private Sub Form_Load()
Set DB = New ADODB.Connection
DB.Open "provider=microsoft.jet.oledb.4.0;data source=" & App.Path & "\EMS.mdb"
Set Rs = New ADODB.Recordset
Rs.Open "info", DB, adOpenKeyset, adLockOptimistic