📄 frmlogin.frm
字号:
VERSION 5.00
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Object = "{F0D2F211-CCB0-11D0-A316-00AA00688B10}#1.0#0"; "MSDATLST.OCX"
Begin VB.Form frmLogin
BorderStyle = 3 'Fixed Dialog
Caption = "登录"
ClientHeight = 2112
ClientLeft = 2832
ClientTop = 3480
ClientWidth = 5184
BeginProperty Font
Name = "宋体"
Size = 10.8
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 1245.421
ScaleMode = 0 'User
ScaleWidth = 4859.72
ShowInTaskbar = 0 'False
StartUpPosition = 2 '屏幕中心
Begin MSAdodcLib.Adodc adoUSM
Height = 312
Left = 2160
Top = 1440
Visible = 0 'False
Width = 960
_ExtentX = 1693
_ExtentY = 550
ConnectMode = 0
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 3
LockType = 3
CommandType = 2
CursorOptions = 0
CacheSize = 50
MaxRecords = 0
BOFAction = 0
EOFAction = 0
ConnectStringType= 3
Appearance = 1
BackColor = -2147483643
ForeColor = -2147483640
Orientation = 0
Enabled = -1
Connect = "DSN=PmData"
OLEDBString = ""
OLEDBFile = ""
DataSourceName = "PmData"
OtherAttributes = ""
UserName = "Admin"
Password = ""
RecordSource = "Usm"
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
_Version = 393216
End
Begin MSDataListLib.DataCombo dcCZ
Bindings = "frmLogin.frx":0000
Height = 300
Left = 1440
TabIndex = 7
ToolTipText = "全宗名称"
Top = 960
Width = 3372
_ExtentX = 5948
_ExtentY = 529
_Version = 393216
ListField = "Zr"
BoundColumn = "ZrID"
Text = ""
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 MSAdodcLib.Adodc adoZR
Height = 312
Left = 2160
Top = 1680
Visible = 0 'False
Width = 960
_ExtentX = 1693
_ExtentY = 550
ConnectMode = 3
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 2
LockType = 3
CommandType = 1
CursorOptions = 0
CacheSize = 50
MaxRecords = 5
BOFAction = 0
EOFAction = 0
ConnectStringType= 3
Appearance = 1
BackColor = -2147483643
ForeColor = -2147483640
Orientation = 0
Enabled = -1
Connect = "DSN=PmData"
OLEDBString = ""
OLEDBFile = ""
DataSourceName = "PmData"
OtherAttributes = ""
UserName = "Admin"
Password = ""
RecordSource = "Select * From ZR Order By CZ"
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
_Version = 393216
End
Begin VB.TextBox txtUserName
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 240
Left = 1416
MaxLength = 20
TabIndex = 1
ToolTipText = "用户名"
Top = 135
Width = 3396
End
Begin VB.CommandButton cmdOK
Caption = "确定"
Default = -1 'True
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 390
Left = 840
TabIndex = 5
ToolTipText = "登录用户"
Top = 1500
Width = 1140
End
Begin VB.CommandButton cmdCancel
Cancel = -1 'True
Caption = "取消"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 390
Left = 3240
TabIndex = 6
ToolTipText = "取消登录"
Top = 1500
Width = 1140
End
Begin VB.TextBox txtPassword
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 264
IMEMode = 3 'DISABLE
Left = 1416
MaxLength = 20
PasswordChar = "*"
TabIndex = 3
ToolTipText = "密码"
Top = 525
Width = 3396
End
Begin VB.Label lblLabels
Caption = "全宗名称(&N)"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 252
Index = 2
Left = 360
TabIndex = 4
Top = 960
Width = 1092
End
Begin VB.Label lblLabels
Caption = "用户名(&U)"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 276
Index = 0
Left = 360
TabIndex = 0
Top = 120
Width = 1080
End
Begin VB.Label lblLabels
Caption = "密 码(&P)"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 276
Index = 1
Left = 360
TabIndex = 2
Top = 540
Width = 1080
End
End
Attribute VB_Name = "frmLogin"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim adoCom As ADODB.Command
Dim adoRst, adoCZRst As ADODB.Recordset
Private Password As String
Dim PasswordTimes As Integer
Private Const SWP_NOSIZE = &H1
Private Const SWP_NOMOVE = &H2
Private Const SWP_NOZORDER = &H4
Private Const SWP_NOREDRAW = &H8
Private Const SWP_NOACTIVATE = &H10
Private Const SWP_FRAMECHANGED = &H20
Private Const SWP_SHOWWINDOW = &H40
Private Const SWP_NOCOPYBITS = &H80
Private Const SWP_NOOWNERZORDER = &H200
Private Const SWP_DRAWFRAME = SWP_FRAMECHANGED
Private Const SWP_NOREPOSITION = SWP_NOOWNERZORDER
Private Const HWND_TOP = 0
Private Const HWND_BOTTOM = 1
Private Const HWND_TOPMOST = -1
Private Const HWND_NOTOPMOST = -2
Private Declare Function SetWindowPos Lib "user32" ( _
ByVal hwnd As Long, _
ByVal hWndInsertAfter As Long, _
ByVal X As Long, _
ByVal Y As Long, _
ByVal cx As Long, _
ByVal cy As Long, _
ByVal wFlags As Long) As Long
Private mbOnTop As Boolean
Private Property Let OnTop(Setting As Boolean)
If Setting Then
SetWindowPos hwnd, -1, 0, 0, 0, 0, SWP_NOMOVE Or SWP_NOSIZE
Else
SetWindowPos hwnd, -2, 0, 0, 0, 0, SWP_NOMOVE Or SWP_NOSIZE
End If
mbOnTop = Setting
End Property
Private Property Get OnTop() As Boolean
'Return the private variable set in Property Let
OnTop = mbOnTop
End Property
Private Sub cmdCancel_Click()
frmLogin.Hide
Unload frmLogin
End
End Sub
Private Sub cmdOK_Click()
Dim strquery As String
Dim i As Integer
Dim oPara As ADODB.Parameter
i = 0
Do While adoCom.Parameters.Count <> 0
adoCom.Parameters.Delete i
i = i + 1
Loop
Set oPara = adoCom.CreateParameter
oPara.Value = Trim(txtUserName.Text)
oPara.Type = adChar
oPara.Size = 20
adoCom.Parameters.Append oPara
strquery = "Select * From USM Where SM1 = ?"
adoCom.CommandText = strquery
Set adoRst = adoCom.Execute
If adoRst.EOF Then
MsgBox "无效的用户名,再试一次!", , "登录"
txtUserName.SetFocus
SendKeys "{Home}+{End}"
Exit Sub
End If
If Not IsNull(adoRst!SM2) Then Password = Trim(adoRst!SM2)
If Password = txtPassword Then
With frmMain
.U_Manage.Enabled = True
.M_File.Enabled = True
.M_Lend.Enabled = True
.M_Data.Enabled = True
.U_LogOut.Enabled = True
.U_LogIn.Enabled = False
With .U_LogOut
.Caption = Left$(.Caption, 2) + " " + Trim(adoRst!SM1) + " " + Right$(.Caption, 4)
End With
End With
adoRst.Close
Call cmdCancel_Click
Else
PasswordTimes = PasswordTimes + 1
If PasswordTimes <= 3 Then
MsgBox "密码无效,再试一次!", , "登录"
txtPassword.SetFocus
SendKeys "{Home}+{End}"
Else
adoRst.Close
End
End If
End If
End Sub
Private Sub dcCZ_Change()
If dcCZ.MatchedWithList Then
frmMain.CZName = dcCZ.Text
Else
dcCZ.Text = frmMain.CZName
End If
End Sub
Private Sub Form_Load()
Dim adoCon As ADODB.Connection
Set adoCon = New ADODB.Connection
Set adoRst = New ADODB.Recordset
Set adoCZRst = New ADODB.Recordset
Set adoCom = New ADODB.Command
adoCon.CursorLocation = adUseClient
adoCon.ConnectionString = "DSN=PmData"
adoCon.Open
Set adoCom.ActiveConnection = adoCon
Set adoRst.ActiveConnection = adoCon
Set adoCZRst.ActiveConnection = adoCon
txtUserName.Text = ""
txtPassword.Text = ""
PasswordTimes = 1
cmdOK.Enabled = False
adoCZRst.Open "Select * From ZR Order By CZ ASC"
dcCZ.Text = adoCZRst.Fields("Zr")
frmMain.CZName = dcCZ.Text
OnTop = True '让窗口 Always On Top
End Sub
Private Sub txtUserName_Change()
If txtUserName.Text = "" Then
cmdOK.Enabled = False
Else
cmdOK.Enabled = True
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -