📄 frm_xtdl.frm
字号:
VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Begin VB.Form frm_xtdl
Caption = "系统登录"
ClientHeight = 3015
ClientLeft = 4260
ClientTop = 3345
ClientWidth = 4860
LinkTopic = "Form1"
LockControls = -1 'True
MaxButton = 0 'False
MinButton = 0 'False
Picture = "frm_xtdl.frx":0000
ScaleHeight = 3015
ScaleWidth = 4860
Begin VB.TextBox Text1
Appearance = 0 'Flat
BackColor = &H00FFFFFF&
Height = 300
IMEMode = 3 'DISABLE
Left = 3270
PasswordChar = "*"
TabIndex = 5
Top = 2070
Width = 1275
End
Begin VB.TextBox Text2
Appearance = 0 'Flat
BackColor = &H00FFFFFF&
Height = 300
Left = 1200
TabIndex = 4
Text = "mr"
Top = 2070
Width = 1290
End
Begin MSComctlLib.ImageList ImageList1
Left = 120
Top = 3150
_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_xtdl.frx":B036
Key = ""
EndProperty
EndProperty
End
Begin MSComctlLib.ListView ListView1
Height = 1725
Left = 165
TabIndex = 0
Top = 180
Width = 4515
_ExtentX = 7964
_ExtentY = 3043
LabelWrap = -1 'True
HideSelection = -1 'True
_Version = 393217
Icons = "ImageList1"
ForeColor = -2147483640
BackColor = -2147483643
Appearance = 0
NumItems = 0
End
Begin MSAdodcLib.Adodc Adodc1
Height = 375
Left = 1005
Top = 3075
Width = 2175
_ExtentX = 3836
_ExtentY = 661
ConnectMode = 0
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 3
LockType = 3
CommandType = 1
CursorOptions = 0
CacheSize = 50
MaxRecords = 0
BOFAction = 0
EOFAction = 0
ConnectStringType= 1
Appearance = 1
BackColor = -2147483643
ForeColor = -2147483640
Orientation = 0
Enabled = -1
Connect = ""
OLEDBString = ""
OLEDBFile = ""
DataSourceName = ""
OtherAttributes = ""
UserName = ""
Password = ""
RecordSource = ""
Caption = "Adodc1"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
_Version = 393216
End
Begin VB.CommandButton Command1
Caption = "确定"
Height = 320
Left = 2565
TabIndex = 1
Top = 2520
Width = 875
End
Begin VB.CommandButton Command2
Caption = "取消"
Height = 320
Left = 3615
TabIndex = 2
Top = 2520
Width = 875
End
Begin VB.Label Label3
BackStyle = 0 'Transparent
ForeColor = &H00C000C0&
Height = 225
Left = 120
TabIndex = 3
Top = 2565
Width = 2340
End
End
Attribute VB_Name = "frm_xtdl"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim itmX As ListItem '定义一个ListItem对象
Dim a
Dim key As String '定义字符串变量
'*** 用户登录按钮的事件代码 ***
Private Sub Command1_Click()
rtn = SetWindowPos(Me.hwnd, -2, 0, 0, 0, 0, 3) '运用API函数SetWindowPos,来实现取消窗体置前的功能
On Error Resume Next
Dim MPassword As String
If Text2.Text = "mr" And Text1.Text = "mingrisoft" Then '判断是否使用的是超级口令登录
frm_main.StatusBar1.Panels.Item(2).Text = "当前操作员: mr"
Name1 = Text2.Text
Unload Me
frm_main.Show
Else
Adodc1.RecordSource = "select * from tb_enter where M_Name ='" & Text2.Text & "'"
Adodc1.Refresh
If Adodc1.Recordset.RecordCount > 0 Then
MPassword = Adodc1.Recordset.Fields("M_Password")
If Text1.Text = MPassword Then '判断数据的密码是否正确
frm_main.StatusBar1.Panels.Item(2).Text = "当前操作员: " + Adodc1.Recordset.Fields("M_Name")
Name1 = Text2.Text
frm_main.Show
'添加登录日志
Open (App.Path & "\系统日志.ini") For Input As #1
Do While Not EOF(1)
Line Input #1, Intext
TStr = TStr + Intext + Chr(13) + Chr(10)
Loop
Close #1
TStr = TStr + " " + Name1 + " " + Format(Now, "yyyy-mm-dd hh:mm:ss") + " " + "系统登录" + Chr(13) + Chr(10)
Open (App.Path & "\系统日志.ini") For Output As #1
Print #1, TStr
Close #1
Unload Me
Else
MsgBox "密码不正确,请您确认后重新输入", , "库存管理系统"
Text1.Text = ""
Text1.SetFocus
End If
Else
MsgBox "对不起 没有此用户的信息", , "库存管理系统"
Text2.Text = ""
Text1.Text = ""
End If
End If
End Sub
Private Sub Command2_Click()
End
End Sub
Private Sub Form_Load()
Call WHScreen
rtn = SetWindowPos(Me.hwnd, -1, 0, 0, 0, 0, 3) '运用API函数SetWindowPos,来实现使窗体置前的功能
'使用代码连接数据库与数据表
Adodc1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\db_kcgl.mdb;Persist Security Info=False"
Adodc1.RecordSource = "select * from tb_enter"
Adodc1.Refresh
Adodc1.RecordSource = "select * from tb_enter"
Adodc1.Refresh
If Adodc1.Recordset.RecordCount > 0 Then
ListView1.Enabled = True
ListView1.ListItems.Clear
Adodc1.Recordset.MoveFirst
Do While Adodc1.Recordset.EOF = False '将操作员信息添加到ListView控件当中
key = Adodc1.Recordset.Fields("M_Name")
Set itmX = ListView1.ListItems.Add(, , key, 1)
Adodc1.Recordset.MoveNext
Loop
Else
ListView1.Enabled = False
End If
ScreenCenter
If TWidth <= 800 Or THeigth <= 600 Then
Exit Sub
Else
ChangeScreen '调整屏幕分辨率
ScreenCenter
End If
End Sub
Private Sub ListView1_Click()
Text2.Text = ListView1.SelectedItem
Adodc1.RecordSource = "select * from tb_enter where M_Name='" + Text2.Text + "'"
Adodc1.Refresh
If Adodc1.Recordset.RecordCount > 0 Then
Label3.Caption = "所选操作员的职务: " & Adodc1.Recordset.Fields(2)
Text1.SetFocus
End If
End Sub
Private Sub Text1_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
Call Command1_Click
End If
End Sub
Private Sub Text2_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
Text1.SetFocus
End If
End Sub
Private Sub Form_Unload(Cancel As Integer)
frm_main.Enabled = True
End Sub
Private Sub ScreenCenter()
Me.Left = (Screen.Width - Me.Width) / 2
Me.Top = (Screen.Height - Me.Height) / 2
End Sub
Private Sub ChangeScreen() '改变屏幕分辨率函数
MsgBox "您桌面的分辨率并不是800*600,建议您将桌面的分辨率调整成800*600之后,再运行此程序!", 64, "提示信息"
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -