📄 frm_login.frm
字号:
VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
Begin VB.Form frm_login
BorderStyle = 0 'None
ClientHeight = 4305
ClientLeft = 0
ClientTop = 0
ClientWidth = 6315
Icon = "frm_login.frx":0000
LinkTopic = "Form1"
LockControls = -1 'True
MaxButton = 0 'False
MinButton = 0 'False
Picture = "frm_login.frx":038A
ScaleHeight = 4305
ScaleWidth = 6315
ShowInTaskbar = 0 'False
StartUpPosition = 2 '屏幕中心
Tag = "登录系统"
Begin VB.TextBox txtPassword
BorderStyle = 0 'None
Height = 195
IMEMode = 3 'DISABLE
Left = 1155
PasswordChar = "*"
TabIndex = 1
Top = 3060
Width = 1635
End
Begin MSComctlLib.ImageList ImageList1
Left = 195
Top = 1455
_ExtentX = 1005
_ExtentY = 1005
BackColor = -2147483643
ImageWidth = 32
ImageHeight = 32
MaskColor = 12632256
_Version = 393216
BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628}
NumListImages = 1
BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "frm_login.frx":58CDE
Key = ""
EndProperty
EndProperty
End
Begin MSComctlLib.ListView ListView1
Height = 2025
Left = 120
TabIndex = 0
Top = 450
Width = 6030
_ExtentX = 10636
_ExtentY = 3572
LabelWrap = -1 'True
HideSelection = -1 'True
_Version = 393217
Icons = "ImageList1"
SmallIcons = "ImageList1"
ForeColor = -2147483640
BackColor = -2147483643
Appearance = 0
NumItems = 0
End
Begin VB.Label Label2
BackStyle = 0 'Transparent
Height = 255
Left = 5865
TabIndex = 7
Top = 30
Width = 285
End
Begin VB.Label Label1
BackStyle = 0 'Transparent
Height = 330
Left = 0
TabIndex = 6
Top = 0
Width = 5625
End
Begin VB.Label Lbl_Exit
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "退 出"
Height = 180
Left = 5115
TabIndex = 5
Top = 3075
Width = 540
End
Begin VB.Label Lbl_OK
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "确 定"
Height = 180
Left = 3780
TabIndex = 4
Top = 3075
Width = 540
End
Begin VB.Label Label3
AutoSize = -1 'True
BackStyle = 0 'Transparent
ForeColor = &H00000000&
Height = 180
Left = 195
TabIndex = 3
Top = 3555
Width = 90
End
Begin VB.Label lblUserName
BackStyle = 0 'Transparent
Height = 225
Left = 1065
TabIndex = 2
Top = 2700
Width = 2835
End
End
Attribute VB_Name = "frm_login"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'*************************************************************************
'**模 块 名:frm_login
'**版权说明:吉林省明日科技有限公司享有本软件的所有版权,如果本软件用于商
'** 业用途,必须经过吉林省明日科技有限公司授权。如果提供网上免费
'** 下载,必须经过吉林省明日科技有限公司授权,并保证程序的完整,
'** 不得修改代码、注释和相关内容,否则,我公司将追究其法律责任
'**网 址:www.mingrisoft.com 价值无限,服务无限
'**电 话:(0431)84978981,84978982
'**创 建 人:明日科技
'**日 期:2007-10-31
'**修 改 人:MRLBB
'**日 期:2007-10-31
'**描 述:
'*************************************************************************
Option Explicit
Dim itmX As ListItem '声明一个ListItem对象
Dim text As String '声明字符串变量
Dim rs1 As New ADODB.Recordset
Dim rs2 As New ADODB.Recordset
Const MaxTimes As Integer = 3
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Private Declare Function ReleaseCapture Lib "user32" () As Long
Const HTCAPTION = 2
Const WM_NCLBUTTONDOWN = &HA1
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Lbl_OK.ForeColor = &H0&
Lbl_Exit.ForeColor = &H0&
End Sub
Private Sub Label1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
Dim ReturnVal
If Button = 1 Then
X = ReleaseCapture()
ReturnVal = SendMessage(hwnd, WM_NCLBUTTONDOWN, HTCAPTION, 0)
End If
End Sub
Private Sub Form_Activate()
txtPassword.SetFocus
End Sub
'以下过程用于初始化界面。
Private Sub Form_Load()
'添加操作员
rs1.Open "select * from tb_power", Cnn, adOpenStatic
If rs1.RecordCount > 0 Then
With rs1
.MoveFirst
lblUserName.Caption = .Fields("操作员")
Do While .EOF = False
text = .Fields("操作员")
Set itmX = ListView1.ListItems.Add(, , text, 1)
.MoveNext
Loop
End With
End If
rs1.Close
Label3.Caption = "初始用户名为:mr 密码为:mrsoft " + Chr(10) + Chr(10) + "本软件由明日科技有限公司开发,欢迎各界朋友来电来函垂询!"
End Sub
Private Sub Label2_Click()
End
End Sub
Private Sub Lbl_Exit_Click()
End
End Sub
Private Sub Lbl_Exit_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Lbl_Exit.ForeColor = RGB(255, 0, 0)
End Sub
'以下过程用于用户单击“确定”按钮后,根据用户选择的操作员信息,验证其输入的密码,
'如果密码正确那么进入主程序,否则进行提示,如果输入3次以上的错误密码,那么退出系统。
Private Sub Lbl_OK_Click()
Static intMyTimes As Integer
rs1.Open "select * from tb_power", Cnn, adOpenStatic
If rs1.RecordCount > 0 Then
rs2.Open "select * from tb_power where 操作员='" + lblUserName + "'and 密码='" + txtPassword.text + "'", Cnn, adOpenStatic
If rs2.RecordCount > 0 Then
OP = lblUserName.Caption
RegInfo frm_login
Load frm_main
frm_main.Show
frm_main.Enabled = True
Unload Me
Else
intMyTimes = intMyTimes + 1
If intMyTimes > MaxTimes Then
MsgBox "您无权使用该软件!"
End
Else
MsgBox "密码不正确,请重新输入!"
txtPassword.SetFocus
End If
End If
rs2.Close
Else
MsgBox "初次登录本系统,请在进入系统后,立即设置操作员及其密码,以确保系统的安全!"
Load frm_main
frm_main.Show
Unload Me
End If
rs1.Close
End Sub
Private Sub Lbl_OK_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Lbl_OK.ForeColor = RGB(255, 0, 0)
End Sub
Private Sub txtPassword_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyReturn Then Lbl_OK_Click
End Sub
'以下过程用于为czy.caption、bh.Caption及jb.Caption赋值。
Private Sub ListView1_Click()
If ListView1.ListItems.Count > 0 Then
lblUserName = ListView1.SelectedItem
End If
End Sub
'以下过程用于用户单击【确认】按钮后,根据用户选择的操作员信息,验证其输入的密码,
'如果密码正确那么进入主程序,否则进行提示,如果输入3次以上的错误密码,那么退出系统。
Private Sub cmdOK_Click()
Static intMyTimes As Integer
rs1.Open "select * from tb_power", Cnn, adOpenStatic
If rs1.RecordCount > 0 Then
rs2.Open "select * from tb_power where 操作员='" + lblUserName + "'and 密码='" + txtPassword.text + "'", Cnn, adOpenStatic
If rs2.RecordCount > 0 Then
OP = lblUserName.Caption
RegInfo frm_login
Load frm_main
frm_main.Show
frm_main.Enabled = True
Unload Me
Else
intMyTimes = intMyTimes + 1
If intMyTimes > MaxTimes Then
MsgBox "您无权使用该软件!"
End
Else
MsgBox "密码不正确,请重新输入!"
txtPassword.SetFocus
End If
End If
rs2.Close
Else
MsgBox "初次登录本系统,请在进入系统后,立即设置操作员及其密码,以确保系统的安全!"
Load frm_main
frm_main.Show
Unload Me
End If
rs1.Close
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -