VERSION 5.00
Object = "{1FB3F7AD-7B17-4DC8-AC0E-35123A4CF9C5}#1.0#0"; "WinXPC Engine.ocx"
Begin VB.Form frm登陆
BackColor = &H00E0E0E0&
BorderStyle = 3 'Fixed Dialog
Caption = "登陆"
ClientHeight = 2115
ClientLeft = 45
ClientTop = 330
ClientWidth = 3360
ControlBox = 0 'False
Icon = "frm登陆.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
MouseIcon = "frm登陆.frx":27A2
ScaleHeight = 2115
ScaleWidth = 3360
ShowInTaskbar = 0 'False
StartUpPosition = 2 '屏幕中心
Begin VB.Frame Frame1
BackColor = &H00E0E0E0&
Height = 1215
Left = 120
TabIndex = 4
Top = 360
Width = 3135
Begin VB.TextBox UserName
Alignment = 2 'Center
BackColor = &H00FFFFFF&
ForeColor = &H00800000&
Height = 270
Left = 840
TabIndex = 0
Top = 240
Width = 2175
End
Begin VB.TextBox txtPassword
Alignment = 2 'Center
BackColor = &H00FFFFFF&
ForeColor = &H000040C0&
Height = 270
IMEMode = 3 'DISABLE
Left = 840
PasswordChar = "*"
TabIndex = 1
Top = 720
Width = 2175
End
Begin VB.Label lblUserName
BackColor = &H00FFC0FF&
BackStyle = 0 'Transparent
Caption = "用户名:"
Height = 255
Left = 120
TabIndex = 6
Top = 240
Width = 735
End
Begin VB.Label lblPassword
BackColor = &H00FFC0FF&
BackStyle = 0 'Transparent
Caption = "密 码:"
Height = 255
Left = 120
TabIndex = 5
Top = 720
Width = 735
End
End
Begin VB.CommandButton cmdCancel
BackColor = &H00008080&
Caption = "取消(&X)"
DisabledPicture = "frm登陆.frx":346C
DownPicture = "frm登陆.frx":4136
DragIcon = "frm登陆.frx":4E00
Height = 315
Left = 1920
MouseIcon = "frm登陆.frx":5ACA
Picture = "frm登陆.frx":6794
TabIndex = 3
Top = 1680
Width = 975
End
Begin VB.CommandButton cmdOk
BackColor = &H00008080&
Cancel = -1 'True
Caption = "确定(&Q)"
Default = -1 'True
Height = 315
Left = 480
MouseIcon = "frm登陆.frx":745E
Style = 1 'Graphical
TabIndex = 2
Top = 1680
Width = 975
End
Begin WinXPC_Engine.WindowsXPC WindowsXPC1
Left = 120
Top = 1560
_ExtentX = 6588
_ExtentY = 1085
ColorScheme = 2
End
Begin VB.Label Label1
BackStyle = 0 'Transparent
Caption = "注:用户名不区分大小写"
Height = 255
Left = 120
TabIndex = 7
Top = 120
Width = 3015
End
End
Attribute VB_Name = "frm登陆"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Public PasswordKey As String
Public NameKey As String
Public Try_times As Integer
Dim i As String
Private Sub cmdOK_Click()
Dim j As Single
'数据有效性检查
If UserName = "" Then
MsgBox "请输入用户名", vbOKOnly + vbCritical, "警告"
UserName.SetFocus
Exit Sub
End If
'If txtPassword = "" Then
If i = "" Then
MsgBox "请输入密码", vbOKOnly + vbCritical, "警告"
txtPassword.SetFocus
Exit Sub
End If
NameKey = MakeStr(UserName)
PasswordKey = MakeStr(i)
'PasswordKey = MakeStr(txtPassword)
'判断用户是否存在
If MyUser.In_DB(NameKey) = False Then
MsgBox "用户名不存在", vbOKOnly + vbCritical, "警告"
UserName = ""
UserName.SetFocus
Try_times = Try_times + 1
If Try_times >= 3 Then
MsgBox "您已经三次尝试进入本系统,均不成功,系统将关闭", vbOKOnly + vbCritical, "警告"
DBapi_Disconnect
End
Else
Exit Sub
End If
End If
'判断密码是否正确
MyUser.GetInfo (NameKey)
If MyUser.passer PasswordKey Then
MsgBox "密码错误", vbOKOnly + vbCritical, "警告"
txtPassword = ""
txtPassword.SetFocus
Try_times = Try_times + 1
If Try_times >= 3 Then
MsgBox "您已经三次尝试进入本系统,均不成功,系统将关闭", vbOKOnly + vbCritical, "警告"
DBapi_Disconnect
End
Else
Exit Sub
End If
End If
'登录成功,将当前用户的信息保存在CurUser中
CurUser.GetInfo (MyUser.name)
'添加系统日志信息
MyLog.Title = "成员:" + Trim(Me.Caption)
MyLog.Body = "登陆系统"
MyLog.LogType = "登陆"
MyLog.UserName = CurUser.name
MyLog.Save
'关闭自己
Unload Me
frm开始.Show
End Sub
Private Sub CmdCancel_Click()
Unload Me '单击“取消”按钮,则卸载“登录”窗口,并退出程序
End
End Sub
Private Sub Form_Load()
On Error GoTo X
'MkDir App.Path + "\data"
MkDir App.Path + "\Image"
FileCopy App.Path + "\职工工资管理.mdb", App.Path + "\DATA\职工工资管理.mdb"
FileCopy App.Path + "\db2.mdb", App.Path + "\DATA\db2.mdb"
FileCopy App.Path + "\034.jpg", App.Path + "\Image\034.jpg"
FileCopy App.Path + "\101.bmp", App.Path + "\Image\101.bmp"
Conn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & _
App.Path + "\DATA\\职工工资管理.mdb;Persist Security Info=False"
WindowsXPC1.InitSubClassing
Kill App.Path + "\职工工资管理.mdb"
Kill App.Path + "\db2.mdb"
Kill App.Path + "\034.jpg"
Kill App.Path + "\101.bmp"
X:
Conn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & _
App.Path + "\DATA\\职工工资管理.mdb;Persist Security Info=False"
WindowsXPC1.InitSubClassing
End Sub
Private Sub txtPassword_Change()
On Error GoTo err
dec = txtPassword 'i为十进制数
DEC_to_BIN = ""
Do While dec > 0
l = CStr(dec Mod 16) 'l为余数
Select Case l
Case "10": l = "A"
Case "11": l = "B"
Case "12": l = "C"
Case "13": l = "D"
Case "14": l = "E"
Case "15": l = "F"
Case "16": l = "G"
Case "17": l = "H"
Case "18": l = "I"
Case "19": l = "J"
Case "20": l = "K"
Case "21": l = "L"
Case "22": l = "M"
Case "23": l = "N"
Case "24": l = "O"
Case "25": l = "Q"
Case "26": l = "R"
Case "27": l = "S"
Case "28": l = "T"
Case "29": l = "U"
Case "30": l = "V"
Case "31": l = "W"
Case "32": l = "X"
Case "33": l = "Y"
Case "34": l = "Z"
End Select
'当前余数加当前DEC_to_BIN值
DEC_to_BIN = l & DEC_to_BIN 'a & DEC_to_HEX
dec = dec \ 16 'Dec = Dec \ 16
i = DEC_to_BIN
Loop
err:
End Sub