📄 frmlogin.frm
字号:
VERSION 5.00
Begin VB.Form frmLogin
BorderStyle = 1 'Fixed Single
Caption = "身份验证"
ClientHeight = 2940
ClientLeft = 5625
ClientTop = 5235
ClientWidth = 7365
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Icon = "frmLogin.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 2940
ScaleWidth = 7365
Begin VB.Frame Frame1
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 1815
Left = 120
TabIndex = 0
Top = 960
Width = 7095
Begin VB.CommandButton cmdQuit
Caption = "取消(&C)"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 5640
Style = 1 'Graphical
TabIndex = 9
Top = 960
Width = 1095
End
Begin VB.CommandButton cmdEnter
Caption = "登录(&E)"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 5640
Style = 1 'Graphical
TabIndex = 8
Top = 360
Width = 1095
End
Begin VB.TextBox txtPassword
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 350
IMEMode = 3 'DISABLE
Left = 2760
PasswordChar = "*"
TabIndex = 2
Top = 960
Width = 2655
End
Begin VB.TextBox txtUser
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 350
Left = 2760
TabIndex = 1
Top = 360
Width = 2655
End
Begin VB.Label Label4
BackColor = &H00808080&
Caption = "Label4"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 5700
TabIndex = 11
Top = 1020
Width = 1095
End
Begin VB.Label Label3
BackColor = &H00808080&
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 5700
TabIndex = 10
Top = 420
Width = 1095
End
Begin VB.Label Label10
BackColor = &H00808080&
Caption = "Label10"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 345
Left = 2820
TabIndex = 6
Top = 1020
Width = 2655
End
Begin VB.Label Label9
BackColor = &H00808080&
Caption = "Label9"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 345
Left = 2820
TabIndex = 5
Top = 420
Width = 2655
End
Begin VB.Label Label6
AutoSize = -1 'True
Caption = "密 码"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 210
Left = 1920
TabIndex = 4
Top = 1080
Width = 690
End
Begin VB.Label Label5
AutoSize = -1 'True
Caption = "用户名"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 210
Left = 1920
TabIndex = 3
Top = 480
Width = 675
End
Begin VB.Image Image1
Height = 1350
Left = 120
Picture = "frmLogin.frx":0442
Stretch = -1 'True
Top = 240
Width = 1545
End
End
Begin VB.Label Label7
BackStyle = 0 'Transparent
Caption = "请输入正确的用户登录资料,如超过3次没登录成功则判为非法登录!本系统也会随之退出。"
ForeColor = &H000000C0&
Height = 450
Left = 240
TabIndex = 12
Top = 240
Width = 6855
End
Begin VB.Label Label1
BackColor = &H00404040&
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 855
Left = 0
TabIndex = 7
Top = 0
Width = 7400
End
End
Attribute VB_Name = "frmLogin"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim Econt As Integer
Private Sub cmdEnter_Click()
Dim ADOrs As New Recordset
ADOrs.ActiveConnection = ADOcn
If txtUser.Text = "" Or txtPassword.Text = "" Then
MsgBox "用户名或密码不能为空!!!"
txtUser.Text = "": txtPassword.Text = ""
txtUser.SetFocus
Econt = Econt + 1
If Econt >= 4 Then
MsgBox "非法登录!!!本系统将退出。"
End
End If
Else
ADOrs.Open ("select * from 用户表 where user_ID='" & txtUser.Text & "'" + " and user_Password='" & EDcode$(txtPassword.Text, 12358) & "'")
'过滤敏感字符
If (InStr(txtUser.Text, "'") <> 0) Or (InStr(txtPassword.Text, "'") <> 0) Then MsgBox "有敏感字符!本系统将退出!!!", vbOKOnly, "非法登录": End
If Not ADOrs.EOF Then
ADOrs.Close
User = txtUser.Text
Unload Me
frmMain.Show
Else
MsgBox "用户名或密码错误!!!"
txtUser.Text = "": txtPassword.Text = ""
txtUser.SetFocus
Econt = Econt + 1
If Econt >= 4 Then
MsgBox "非法登录!!!本系统将退出。"
End
End If
End If
End If
End Sub
Private Sub cmdEnter_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
Call cmdMouseDown(cmdEnter)
End Sub
Private Sub cmdEnter_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
cmdEnter.BackColor = &H8000000D
End Sub
Private Sub cmdEnter_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
Call cmdMouseUp(cmdEnter)
End Sub
Private Sub cmdQuit_Click()
End
End Sub
Private Sub cmdQuit_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
Call cmdMouseDown(cmdQuit)
End Sub
Private Sub cmdQuit_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
cmdQuit.BackColor = &H8000000D
End Sub
Private Sub cmdQuit_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
Call cmdMouseUp(cmdQuit)
End Sub
Private Sub Form_Load()
Econt = 1
End Sub
Private Sub Frame1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
cmdEnter.BackColor = &H8000000F
cmdQuit.BackColor = &H8000000F
End Sub
Private Sub txtPassword_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then Call cmdEnter_Click
End Sub
Private Sub txtUser_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then txtPassword.SetFocus
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -