📄 frmlegoin.frm
字号:
VERSION 5.00
Begin VB.Form frmlegoin
BackColor = &H80000004&
BorderStyle = 4 'Fixed ToolWindow
Caption = "登录界面"
ClientHeight = 5925
ClientLeft = 3150
ClientTop = 3000
ClientWidth = 8925
ControlBox = 0 'False
ForeColor = &H00C0FFC0&
Icon = "frmlegoin.frx":0000
LinkTopic = "form1"
MaxButton = 0 'False
MinButton = 0 'False
MouseIcon = "frmlegoin.frx":030A
Picture = "frmlegoin.frx":074C
ScaleHeight = 5925
ScaleWidth = 8925
ShowInTaskbar = 0 'False
Begin VB.Frame Frame1
BackColor = &H0080C0FF&
Height = 135
Left = 720
TabIndex = 8
Top = 1080
Width = 7935
End
Begin VB.Timer Timer1
Interval = 5
Left = 120
Top = 1080
End
Begin VB.TextBox txt_usersID
BackColor = &H0080FFFF&
Height = 420
IMEMode = 3 'DISABLE
Left = 3600
MaxLength = 10
TabIndex = 0
ToolTipText = "登陆ID号"
Top = 2040
Width = 2415
End
Begin VB.CommandButton cmdOK
BackColor = &H80000004&
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 1320
Picture = "frmlegoin.frx":B9D0
Style = 1 'Graphical
TabIndex = 2
Top = 4200
Width = 1000
End
Begin VB.CommandButton cmdexit
BackColor = &H80000004&
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 3960
MaskColor = &H00C0C0FF&
Picture = "frmlegoin.frx":C822
Style = 1 'Graphical
TabIndex = 3
Top = 4200
Width = 1000
End
Begin VB.CommandButton cmdnewuser
BackColor = &H80000004&
Caption = "注册用户"
Height = 375
Left = 6480
Style = 1 'Graphical
TabIndex = 4
Top = 4200
Width = 1000
End
Begin VB.TextBox txt_password
BackColor = &H0080FFFF&
Height = 420
IMEMode = 3 'DISABLE
Left = 3600
MaxLength = 10
PasswordChar = "*"
TabIndex = 1
ToolTipText = "登陆密码"
Top = 3000
Width = 2415
End
Begin VB.Line Line3
X1 = 120
X2 = 8880
Y1 = 960
Y2 = 960
End
Begin VB.Line Line1
X1 = 2040
X2 = 6960
Y1 = 3720
Y2 = 3720
End
Begin VB.Label Label1
AutoSize = -1 'True
BackColor = &H00FFC0C0&
BackStyle = 0 'Transparent
Caption = "用户登录ID"
BeginProperty Font
Name = "宋体"
Size = 15.75
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H000000FF&
Height = 315
Left = 1920
TabIndex = 7
Top = 2160
Width = 1680
End
Begin VB.Label Label2
AutoSize = -1 'True
BackColor = &H00FFC0C0&
BackStyle = 0 'Transparent
Caption = "登录口令"
BeginProperty Font
Name = "宋体"
Size = 15.75
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H000000FF&
Height = 315
Left = 2280
TabIndex = 6
Top = 3120
Width = 1320
End
Begin VB.Label Label4
BackStyle = 0 'Transparent
Caption = "欢迎进入学生寝室卫生检查管理系统登录界面"
BeginProperty Font
Name = "华文彩云"
Size = 21.75
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H000000FF&
Height = 735
Left = 0
TabIndex = 5
Top = 360
Width = 9015
End
Begin VB.Image Image1
Height = 1890
Left = 1080
Picture = "frmlegoin.frx":D674
Top = 1800
Width = 885
End
End
Attribute VB_Name = "frmlegoin"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim miCount As Integer
Private Declare Function GetUserName Lib "advapi32.dll" Alias "GetUserNameA" (ByVal lpbuffer As String, nSize As Long) As Long
Public OK As Boolean
Private Sub cmdexit_Click()
Unload Me
End Sub
Private Sub cmdnewuser_Click()
frmadduser.Show
End Sub
Private Sub cmdOK_Click()
Dim txtSQL As String
Dim mrc As ADODB.Recordset
Dim MsgText As String
'ToDo: create test for correct password
'check for correct password
UserName = ""
If Trim(txt_usersID.Text = "") Then
MsgBox "没有这个用户,请重新输入用户名!", vbOKOnly + vbExclamation, "警告"
txt_usersID.SetFocus
Else
txtSQL = "select * from user_If where user_ID = '" & txt_usersID.Text & "'"
Set mrc = ExecuteSQL(txtSQL, MsgText)
If mrc.EOF = True Then
MsgBox "没有这个用户,请重新输入用户名!", vbOKOnly + vbExclamation, "警告"
txt_usersID.SetFocus
Else
If Trim(mrc.Fields(1)) = Trim(txt_password.Text) Then
OK = True
mrc.Close
Unload Me
UserName = Trim(txt_usersID.Text)
Form1.Show
Else
MsgBox "输入密码不正确,请重新输入!", vbOKOnly + vbExclamation, "警告"
txt_password.SetFocus
txt_password.Text = ""
End If
End If
End If
miCount = miCount + 1
If miCount = 3 Then
MsgBox "对不起!您登录的次数超过3次,将自动取消!", vbOKOnly + vbInformation, "警告"
Me.Hide
End If
Exit Sub
End Sub
Private Sub Command1_Click()
End Sub
Private Sub Form_Load()
Dim sBuffer As String
Dim lSize As Long
sBuffer = Space$(255)
lSize = Len(sBuffer)
Call GetUserName(sBuffer, lSize)
If lSize > 0 Then
txt_usersID.Text = ""
Else
txt_usersID.Text = vbNullString
End If
OK = False
miCount = 0
End Sub
Private Sub Timer1_Timer()
Label4.Left = Label4.Left - 10
If Label4.Left < 0 Then Label4.Left = Label4.Left + 8000
End Sub
Private Sub w_Change()
End Sub
Private Sub txt_password_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then cmdOK.SetFocus
End Sub
Private Sub txt_usersID_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then txt_password.SetFocus
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -