📄 frmlogin.frm
字号:
VERSION 5.00
Begin VB.Form frmLogin
BorderStyle = 3 'Fixed Dialog
Caption = "登录"
ClientHeight = 1950
ClientLeft = 45
ClientTop = 330
ClientWidth = 4065
Icon = "frmLogin.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 1950
ScaleWidth = 4065
ShowInTaskbar = 0 'False
StartUpPosition = 2 '屏幕中心
Tag = "1032"
Begin VB.CommandButton cmdCancel
Cancel = -1 'True
Caption = "取消"
Height = 360
Left = 2100
TabIndex = 4
Tag = "1036"
Top = 1020
Width = 1140
End
Begin VB.CommandButton cmdOK
Caption = "确定"
Default = -1 'True
Height = 360
Left = 495
TabIndex = 3
Tag = "1035"
Top = 1020
Width = 1140
End
Begin VB.TextBox txtPassword
Height = 270
IMEMode = 3 'DISABLE
Left = 1305
PasswordChar = "*"
TabIndex = 2
Text = "admin"
Top = 525
Width = 2325
End
Begin VB.TextBox txtUserName
Height = 270
Left = 1305
TabIndex = 1
Text = "admin"
Top = 135
Width = 2325
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "注:默认用户名密码为:admin/admin"
ForeColor = &H8000000D&
Height = 180
Left = 240
TabIndex = 6
Top = 1560
Width = 2970
End
Begin VB.Label lblLabels
Caption = "密码(&P):"
Height = 248
Index = 1
Left = 105
TabIndex = 0
Tag = "1034"
Top = 540
Width = 1080
End
Begin VB.Label lblLabels
Caption = "用户名(&U):"
Height = 248
Index = 0
Left = 105
TabIndex = 5
Tag = "1033"
Top = 150
Width = 1080
End
End
Attribute VB_Name = "frmLogin"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Declare Function GetUserName Lib "advapi32.dll" Alias "GetUserNameA" (ByVal lpbuffer As String, nSize As Long) As Long
Public OK As Boolean
Dim m_Admin As New clsAdmin
Dim m_nErrCount As Integer
Private Sub Form_Load()
m_nErrCount = 0
End Sub
Private Sub cmdCancel_Click()
OK = False
Me.Hide
End Sub
Private Sub cmdOK_Click()
'ToDo: 创建测试密码是否正确
'检查正确密码
Dim Account As String
Dim Pwd As String
Account = RealString(txtUserName.Text)
Pwd = RealString(txtPassword.Text)
'判断密码是否正确
If Not m_Admin.CheckPwd(Account, Pwd) Then
m_nErrCount = m_nErrCount + 1
If m_nErrCount >= 3 Then
MsgBox "输入密码错误次数太多,请稍后重试", vbExclamation
End
End If
MsgBox "密码错误,再试一次!还有 " & 3 - m_nErrCount & " 次机会,注意密码区分大小写", vbCritical, "登录"
txtPassword.SetFocus
txtPassword.SelStart = 0
txtPassword.SelLength = Len(txtPassword.Text)
Else
OK = True
g_Account = Account
Me.Hide
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -