📄 login.frm
字号:
VERSION 5.00
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Begin VB.Form login
Caption = "登陆"
ClientHeight = 3615
ClientLeft = 60
ClientTop = 450
ClientWidth = 5910
Icon = "login.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
Picture = "login.frx":6852
ScaleHeight = 3615
ScaleWidth = 5910
StartUpPosition = 2 '屏幕中心
Begin MSAdodcLib.Adodc Adodc1
Height = 375
Left = 120
Top = 2880
Visible = 0 'False
Width = 1575
_ExtentX = 2778
_ExtentY = 661
ConnectMode = 0
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 3
LockType = 3
CommandType = 8
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.Frame Frame1
Height = 2415
Left = 1920
TabIndex = 4
Top = 240
Width = 3735
Begin VB.CommandButton Command3
Height = 255
Left = 3240
Picture = "login.frx":8172
Style = 1 'Graphical
TabIndex = 8
TabStop = 0 'False
ToolTipText = "启动系统软键盘"
Top = 1320
Width = 375
End
Begin VB.TextBox txtName
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 1200
MaxLength = 8
TabIndex = 0
ToolTipText = "双击启动系统软键盘"
Top = 480
Width = 1935
End
Begin VB.TextBox txtPassword
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
IMEMode = 3 'DISABLE
Left = 1200
MaxLength = 16
PasswordChar = "*"
TabIndex = 1
ToolTipText = "双击启动系统软键盘"
Top = 1200
Width = 1935
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "用户名:"
Height = 180
Left = 360
TabIndex = 7
Top = 600
Width = 720
End
Begin VB.Label Label2
AutoSize = -1 'True
Caption = "密 码:"
Height = 180
Left = 360
TabIndex = 6
Top = 1320
Width = 720
End
Begin VB.Label Label3
Caption = "系统管理员初始用户名、密码均为admin,首次登陆后请及时更改!"
Height = 495
Left = 480
TabIndex = 5
Top = 1800
Width = 2895
End
End
Begin VB.CommandButton Command1
Caption = "登陆(&L)"
Height = 495
Left = 2160
TabIndex = 2
Top = 2880
Width = 1095
End
Begin VB.CommandButton Command2
Caption = "退出(&Q)"
Height = 495
Left = 4080
TabIndex = 3
Top = 2880
Width = 1095
End
End
Attribute VB_Name = "login"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim txtRS As String
Dim txtsql As String
Dim ctr As String
Private Sub Command1_Click()
systemuser = txtName.Text
Adodc1.RecordSource = "select * from 操作员信息"
Adodc1.Refresh
On Error Resume Next
txtRS = Adodc1.Recordset.Fields(1)
If txtRS = "" Then '首先判断该系统是否有用户
MsgBox "尊敬的用户,你还没有注册为本系统用户,请尽快注册为系统用户"
操作员设置.Show '窗体的 Show方法 显示指定的窗体
Unload Me
Exit Sub
End If
Adodc1.RecordSource = "select * from 操作员信息 where 用户名='" + txtName.Text + "'and 密码='" + txtPassword.Text + "'"
Adodc1.Refresh
If Adodc1.Recordset.Fields(3).Value = 0 Then
Else
系统主窗口.Show '窗体的 Show方法 显示指定的窗体
Unload Me
Exit Sub
End If
'为其他系统用户分配权限
If Adodc1.Recordset.RecordCount > 0 Then
If Adodc1.Recordset.Fields(3).Value Then
系统主窗口.cellphone.Enabled = True
系统主窗口.fastgo.Enabled = True
Else
系统主窗口.database.Enabled = False
系统主窗口.mapset.Enabled = False
系统主窗口.opset.Enabled = False
系统主窗口.DB.Enabled = False
系统主窗口.cellset.Enabled = False
End If
系统主窗口.Show
Unload Me
Else
MsgBox "用户名或密码错误!", 0 + 48, "警告"
txtName.SetFocus '使控件获得焦点
txtName.SelStart = 0
txtName.SelLength = Len(txtName.Text)
Exit Sub
End If
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
Private Sub Command3_Click()
Dim ReturnValue
ReturnValue = Shell("osk.EXE", 1) '启动系统软键盘
AppActivate ReturnValue
txtPassword.SetFocus
End Sub
Private Sub Form_Load()
On Error GoTo error1
Adodc1.ConnectionString = PublicStr
Adodc1.RecordSource = "select * from 操作员信息"
Adodc1.Refresh
error1:
If Err.Number = -2147467259 Then
Dim c
c = MsgBox("数据库连接失败,请重新设置数据库!", 1 + 48, "警告!")
If c = 1 Then
'Call ShellExecute(Me.hwnd, "Open", App.Path & "\初始数据库设置.exe", "", App.Path, 1)
Dim RetVal
RetVal = Shell(App.Path & "\初始数据库设置.exe", 1)
Unload Me
Unload 启动窗口
Else
Unload Me
Unload 启动窗口
End If
End If
End Sub
Private Sub txtName_DblClick()
Dim ReturnValue
ReturnValue = Shell("osk.EXE", 1) '启动系统软键盘
AppActivate ReturnValue
End Sub
Private Sub txtPassword_DblClick()
Dim ReturnValue
ReturnValue = Shell("osk.EXE", 1) '启动系统软键盘
AppActivate ReturnValue
End Sub
Private Sub txtName_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then SendKeys "{TAB}"
End Sub
Private Sub txtPassword_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then Call Command1_Click
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -