📄 frmlogin.frm
字号:
VERSION 5.00
Object = "{E95A2510-F3D1-416D-823B-4F840FE98091}#3.0#0"; "Command.ocx"
Object = "{9BFA62E2-F44A-4ACC-B598-CE9A4D54AF9E}#1.0#0"; "Cocx1.ocx"
Begin VB.Form frmlogin
BorderStyle = 1 'Fixed Single
Caption = "登录"
ClientHeight = 2535
ClientLeft = 45
ClientTop = 330
ClientWidth = 4815
Icon = "frmlogin.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 2535
ScaleWidth = 4815
StartUpPosition = 2 '屏幕中心
Begin VB.Frame Frame1
Appearance = 0 'Flat
BackColor = &H80000005&
ForeColor = &H80000008&
Height = 2535
Left = 0
TabIndex = 0
Top = 0
Width = 4815
Begin CSCommand.Command Command1
Height = 375
Left = 120
TabIndex = 6
Top = 1920
Width = 975
_ExtentX = 1720
_ExtentY = 661
PICMaskColor = 8438015
IconAlign = 0
Icon = "frmlogin.frx":D1DE
Caption = "确定"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Appearance = 1
BackStyle = 0
End
Begin VB.ComboBox Combo2
Height = 300
Left = 2760
TabIndex = 4
Top = 240
Width = 1215
End
Begin VB.CheckBox Check1
BackColor = &H00C0C000&
Caption = "记住密码"
Height = 255
Left = 120
TabIndex = 3
Top = 1440
Width = 1095
End
Begin VB.ComboBox Combo1
Height = 300
ItemData = "frmlogin.frx":D1FA
Left = 2760
List = "frmlogin.frx":D204
TabIndex = 2
Top = 600
Width = 1215
End
Begin VB.TextBox Text2
Appearance = 0 'Flat
Height = 375
IMEMode = 3 'DISABLE
Left = 2760
PasswordChar = "*"
TabIndex = 1
Top = 1080
Width = 1215
End
Begin CSCommand.Command Command2
Height = 375
Left = 1320
TabIndex = 8
Top = 1920
Width = 975
_ExtentX = 1720
_ExtentY = 661
IconAlign = 0
Icon = "frmlogin.frx":D218
Caption = "取消"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
End
Begin CSCommand.Command Command4
Height = 375
Left = 2520
TabIndex = 5
Top = 1920
Width = 975
_ExtentX = 1720
_ExtentY = 661
IconAlign = 0
Icon = "frmlogin.frx":D234
Caption = "修改密码"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
End
Begin CSCommand.Command Command3
Height = 375
Left = 3720
TabIndex = 7
Top = 1920
Width = 975
_ExtentX = 1720
_ExtentY = 661
IconAlign = 0
Icon = "frmlogin.frx":D250
Caption = "退出"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
End
Begin VB.PictureBox Picture1
BackColor = &H00C0C000&
BorderStyle = 0 'None
Height = 2895
Left = 0
ScaleHeight = 2895
ScaleWidth = 11655
TabIndex = 9
Top = 0
Width = 11655
Begin VB.PictureBox Picture2
Appearance = 0 'Flat
AutoSize = -1 'True
BackColor = &H80000005&
BorderStyle = 0 'None
ForeColor = &H80000008&
Height = 480
Left = 1320
Picture = "frmlogin.frx":D26C
ScaleHeight = 480
ScaleWidth = 480
TabIndex = 10
Top = 1080
Width = 480
End
Begin XV_MYAPIOCX.MYOCX MYOCX1
Height = 480
Left = 4200
TabIndex = 14
Top = 1440
Visible = 0 'False
Width = 480
_ExtentX = 847
_ExtentY = 847
End
Begin VB.Label Label1
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "姓名"
Height = 180
Left = 2160
TabIndex = 13
Top = 360
Width = 360
End
Begin VB.Label Label2
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "权限"
Height = 180
Left = 2160
TabIndex = 12
Top = 720
Width = 360
End
Begin VB.Label Label3
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "密码"
Height = 180
Left = 2280
TabIndex = 11
Top = 1080
Width = 360
End
Begin VB.Image Image1
Height = 480
Left = 1320
Picture = "frmlogin.frx":D6AE
Top = 240
Width = 480
End
End
End
End
Attribute VB_Name = "frmlogin"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Public InOp As String
Private Sub Command1_Click()
If Check1.Value = 1 Then
Set rec = New ADODB.Recordset
rec.Open "select * from 记住密码", gCnn, 3, 3
rec("标记") = "1"
If Combo2.Text <> "" Then
rec("姓名") = Combo2.Text
Else
rec("姓名") = ""
End If
If Combo1.Text <> "" Then
rec("权限") = Combo1.Text
Else
rec("权限") = ""
End If
If Text2.Text <> "" Then
rec("密码") = Text2.Text
Else
rec("密码") = ""
End If
rec.Update
rec.Close
Else
Set rec = New ADODB.Recordset
rec.Open "select * from 记住密码", gCnn, 3, 3
rec("标记") = "0"
rec.Update
rec.Close
End If
Dim rec1 As ADODB.Recordset
Set rec1 = New ADODB.Recordset
rec1.Open "select * from 登录人员", gCnn, 3, 3
Set rec = New ADODB.Recordset
rec.Open "select * from 密码表 where 姓名='" & Combo2.Text & "'and 操作权限='" & Combo1.Text & "'and 密码='" & Text2.Text & "'", gCnn, 3, 3
If rec.EOF = False Then
If rec("操作权限") <> "管理员" Then
' FRMMAIN.XZCK.Enabled = False
MDIme.mczy.Enabled = False '基本数据维护
'MDIme.xtwh.Enabled = False '系统数据维护
' MDIme.del.Enabled = False ' 删除资料
Else
MDIme.mczy.Enabled = True
' MDIme.xtwh.Enabled = True '
' CreateNewKey HKEY_CURRENT_USER, "datacentre"
' SetKeyValue HKEY_CURRENT_USER, "datacentre", "UserName", Combo2.Text, REG_SZ
' SetKeyValue HKEY_CURRENT_USER, "datacentre", "PassWord", Text2.Text, REG_SZ
End If
rec1("姓名") = Combo2.Text
rec1.Update
rec1.Close
Me.Hide
Guser = Combo2.Text
MDIme.Show
InOp = Trim(Combo2.Text)
Else
MsgBox "权限或密码不正确,请重试!", vbInformation
End If
rec.Close
End Sub
Private Sub Command2_Click()
Combo2.Text = ""
Text2.Text = ""
Combo1.Text = ""
End Sub
Private Sub Command3_Click()
End
End Sub
Private Sub Command4_Click()
Me.Hide
FRMMMXG.Show 1
End Sub
Private Sub Form_Activate()
Text2.Text = ""
Combo1.Text = ""
Combo2.Text = ""
Set rec = New ADODB.Recordset
rec.Open "select * from 记住密码", gCnn, 3, 3
If rec("标记") = "0" Or rec("标记") = "1" Then
Check1.Value = rec("标记")
End If
rec.Close
Set rec = New ADODB.Recordset
rec.Open "select * from 记住密码", gCnn, 3, 3
If rec("标记") = 1 Then
Combo2.Text = rec("姓名")
Combo1.Text = rec("权限")
Text2.Text = rec("密码")
End If
rec.Close
Command1.SetFocus
End Sub
Private Sub Form_Load()
Dim ob As Control
Set ob = Me.Frame1
hostName = MYOCX1.F_WIN9X_获取机器名()
gCnn.ConnectionString = cnn
gCnn.CursorLocation = adUseClient
gCnn.Open
Set rec = New ADODB.Recordset
rec.Open "select distinct 姓名 from 密码表", gCnn, 3, 3
With Combo2
Do Until rec.EOF
.AddItem rec("姓名")
rec.MoveNext
Loop
End With
rec.Close
Set rec = Nothing
End Sub
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
Cancel = True
Select Case MsgBox("此操作将退出本系统,继续吗?", vbYesNo, "警告")
Case vbYes
Cancel = False
End
Case Else
Cancel = True
End Select
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -