📄 frmlogin.vb
字号:
Me._Line3_0.BackColor = System.Drawing.Color.FromArgb(CType(128, Byte), CType(128, Byte), CType(128, Byte))
Me.Line3.SetIndex(Me._Line3_0, CType(0, Short))
Me._Line3_0.Location = New System.Drawing.Point(0, 2)
Me._Line3_0.Name = "_Line3_0"
Me._Line3_0.Size = New System.Drawing.Size(1, 243)
Me._Line3_0.TabIndex = 15
'
'_Line2_1
'
Me._Line2_1.BackColor = System.Drawing.Color.FromArgb(CType(224, Byte), CType(224, Byte), CType(224, Byte))
Me.Line2.SetIndex(Me._Line2_1, CType(1, Short))
Me._Line2_1.Location = New System.Drawing.Point(0, 2)
Me._Line2_1.Name = "_Line2_1"
Me._Line2_1.Size = New System.Drawing.Size(397, 1)
Me._Line2_1.TabIndex = 16
'
'_Line1_1
'
Me._Line1_1.BackColor = System.Drawing.Color.FromArgb(CType(128, Byte), CType(128, Byte), CType(128, Byte))
Me.Line1.SetIndex(Me._Line1_1, CType(1, Short))
Me._Line1_1.Name = "_Line1_1"
Me._Line1_1.Size = New System.Drawing.Size(398, 1)
Me._Line1_1.TabIndex = 17
'
'_Line2_0
'
Me._Line2_0.BackColor = System.Drawing.Color.FromArgb(CType(224, Byte), CType(224, Byte), CType(224, Byte))
Me.Line2.SetIndex(Me._Line2_0, CType(0, Short))
Me._Line2_0.Location = New System.Drawing.Point(4, 244)
Me._Line2_0.Name = "_Line2_0"
Me._Line2_0.Size = New System.Drawing.Size(397, 1)
Me._Line2_0.TabIndex = 18
'
'_Line1_0
'
Me._Line1_0.BackColor = System.Drawing.Color.FromArgb(CType(128, Byte), CType(128, Byte), CType(128, Byte))
Me.Line1.SetIndex(Me._Line1_0, CType(0, Short))
Me._Line1_0.Location = New System.Drawing.Point(4, 243)
Me._Line1_0.Name = "_Line1_0"
Me._Line1_0.Size = New System.Drawing.Size(394, 1)
Me._Line1_0.TabIndex = 19
'
'_lblLabels_0
'
Me._lblLabels_0.AutoSize = True
Me._lblLabels_0.BackColor = System.Drawing.Color.Transparent
Me._lblLabels_0.Cursor = System.Windows.Forms.Cursors.Default
Me._lblLabels_0.ForeColor = System.Drawing.SystemColors.ControlText
Me.lblLabels.SetIndex(Me._lblLabels_0, CType(0, Short))
Me._lblLabels_0.Location = New System.Drawing.Point(54, 30)
Me._lblLabels_0.Name = "_lblLabels_0"
Me._lblLabels_0.RightToLeft = System.Windows.Forms.RightToLeft.No
Me._lblLabels_0.Size = New System.Drawing.Size(66, 14)
Me._lblLabels_0.TabIndex = 4
Me._lblLabels_0.Text = "用户名(&U):"
'
'_lblLabels_1
'
Me._lblLabels_1.AutoSize = True
Me._lblLabels_1.BackColor = System.Drawing.Color.Transparent
Me._lblLabels_1.Cursor = System.Windows.Forms.Cursors.Default
Me._lblLabels_1.ForeColor = System.Drawing.SystemColors.ControlText
Me.lblLabels.SetIndex(Me._lblLabels_1, CType(1, Short))
Me._lblLabels_1.Location = New System.Drawing.Point(68, 59)
Me._lblLabels_1.Name = "_lblLabels_1"
Me._lblLabels_1.RightToLeft = System.Windows.Forms.RightToLeft.No
Me._lblLabels_1.Size = New System.Drawing.Size(54, 14)
Me._lblLabels_1.TabIndex = 5
Me._lblLabels_1.Text = "密码(&P):"
'
'frmLogin
'
Me.AcceptButton = Me.cmdOK
Me.AutoScaleBaseSize = New System.Drawing.Size(6, 14)
Me.BackColor = System.Drawing.Color.FromArgb(CType(192, Byte), CType(192, Byte), CType(0, Byte))
Me.CancelButton = Me.cmdCancel
Me.ClientSize = New System.Drawing.Size(352, 117)
Me.Controls.AddRange(New System.Windows.Forms.Control() {Me._Picture1_1, Me.UserTxt, Me._Picture1_0, Me.cmdOK, Me.cmdCancel, Me.txtPassword, Me.Line8, Me.Line7, Me.Line6, Me.Line5, Me._Line4_1, Me._Line3_1, Me._Line4_0, Me._Line3_0, Me._Line2_1, Me._Line1_1, Me._Line2_0, Me._Line1_0, Me._lblLabels_0, Me._lblLabels_1})
Me.Icon = CType(resources.GetObject("$this.Icon"), System.Drawing.Icon)
Me.Location = New System.Drawing.Point(190, 233)
Me.MaximizeBox = False
Me.Name = "frmLogin"
Me.StartPosition = System.Windows.Forms.FormStartPosition.Manual
Me.Text = "登录窗口"
CType(Me.Line1, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.Line2, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.Line3, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.Line4, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.Picture1, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.lblLabels, System.ComponentModel.ISupportInitialize).EndInit()
Me.ResumeLayout(False)
End Sub
#End Region
#Region "升级支持"
Private Shared m_vb6FormDefInstance As frmLogin
Private Shared m_InitializingDefInstance As Boolean
Public Shared Property DefInstance() As frmLogin
Get
If m_vb6FormDefInstance Is Nothing OrElse m_vb6FormDefInstance.IsDisposed Then
m_InitializingDefInstance = True
m_vb6FormDefInstance = New frmLogin()
m_InitializingDefInstance = False
End If
DefInstance = m_vb6FormDefInstance
End Get
Set
m_vb6FormDefInstance = Value
End Set
End Property
#End Region
Dim LOGINNO As Short
Dim PassYu(30) As String
Dim strPurView(30) As String
Private Declare Function SetActiveWindow Lib "user32" (ByVal hwnd As Integer) As Integer
Private Sub cmdCancel_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles cmdCancel.Click
Me.Close()
End Sub
Private Sub cmdOK_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles cmdOK.Click
'检查密码的正确性
Dim X As Integer
X = UserTxt.SelectedIndex
'如果有加密,解密方法放此处,将PassYu(X)数组中的值,
'转换成原来信息
Dim FindStr As String
'将加密口令变回来
Dim shiftStr, SureStr As String
Dim shiftStrR As Object
Dim shiftNum, ili As Short
shiftStr = Trim(txtPassword.Text)
shiftNum = Len(shiftStr)
ili = 1
SureStr = ""
For ili = 1 To shiftNum
'UPGRADE_WARNING: 未能解析对象 shiftStrR 的默认属性。 单击以获得更多信息:'ms-help://MS.VSCC/commoner/redir/redirect.htm?keyword="vbup1037"'
shiftStrR = Mid(shiftStr, ili, 1)
'UPGRADE_WARNING: 未能解析对象 shiftStrR 的默认属性。 单击以获得更多信息:'ms-help://MS.VSCC/commoner/redir/redirect.htm?keyword="vbup1037"'
shiftStrR = Asc(shiftStrR)
'UPGRADE_WARNING: 未能解析对象 shiftStrR 的默认属性。 单击以获得更多信息:'ms-help://MS.VSCC/commoner/redir/redirect.htm?keyword="vbup1037"'
shiftStrR = shiftStrR - 3
'UPGRADE_WARNING: 未能解析对象 shiftStrR 的默认属性。 单击以获得更多信息:'ms-help://MS.VSCC/commoner/redir/redirect.htm?keyword="vbup1037"'
shiftStrR = Chr(shiftStrR)
'UPGRADE_WARNING: 未能解析对象 shiftStrR 的默认属性。 单击以获得更多信息:'ms-help://MS.VSCC/commoner/redir/redirect.htm?keyword="vbup1037"'
SureStr = SureStr & shiftStrR
Next
'密匙
'开始查找 sureStr为解除的口令
If SureStr = PassYu(X) Then
UserText = UserTxt.Text
PurView = strPurView(X)
'密码正确时
frmLogin.DefInstance.Cursor = System.Windows.Forms.Cursors.WaitCursor
Me.Close()
frmSplash.DefInstance.Show()
Exit Sub
Else
MsgBox("无效的密码,再试一次!", 32, "登录")
LOGINNO = LOGINNO + 1
If LOGINNO > 3 Then
MsgBox("对不起,您不能使用该系统!", 64, "登录失败")
Me.Close()
Exit Sub
End If
txtPassword.Focus()
System.Windows.Forms.SendKeys.Send("{Home}+{End}")
End If
End Sub
Private Sub frmLogin_Load(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles MyBase.Load
On Error Resume Next
Me.Left = VB6.TwipsToPixelsX(Val(GetSetting(VB6.GetExeName(), "Login", "Left")))
Me.Top = VB6.TwipsToPixelsY(Val(GetSetting(VB6.GetExeName(), "Login", "Top")))
Dim retValue As Integer
retValue = SetActiveWindow(Me.Handle.ToInt32)
Browser = CurDir()
'设计时定义temp dir
'Browser = "D:\Program\Study\文件管理"
If VB.Right(Browser, 1) <> "\" Then
Browser = Browser & "\"
End If
checkPath("") '检测路径
Dim DB As DAO.Database
Dim EF As DAO.Recordset
Dim X, i As Integer
Dim UserYu(10) As String
DB = DAODBEngine_definst.OpenDatabase(ConData, False, False, ConStr)
EF = DB.OpenRecordset("User", DAO.RecordsetTypeEnum.dbOpenTable)
X = EF.RecordCount
EF = DB.OpenRecordset("User", DAO.RecordsetTypeEnum.dbOpenDynaset)
For i = 0 To X - 1
UserYu(i) = EF.Fields(0).Value
'UPGRADE_WARNING: 检测到使用了 Null/IsNull()。 单击以获得更多信息:'ms-help://MS.VSCC/commoner/redir/redirect.htm?keyword="vbup1049"'
If Not IsDbNull(EF.Fields(1).Value) Then
PassYu(i) = EF.Fields(1).Value
End If
'UPGRADE_WARNING: 检测到使用了 Null/IsNull()。 单击以获得更多信息:'ms-help://MS.VSCC/commoner/redir/redirect.htm?keyword="vbup1049"'
If Not IsDbNull(EF.Fields(2).Value) Then
strPurView(i) = EF.Fields(2).Value
End If
UserTxt.Items.Insert(i, UserYu(i))
EF.MoveNext()
Next
EF.Close()
DB.Close()
If X >= 1 Then
UserTxt.SelectedIndex = 0
End If
LOGINNO = 1
End Sub
'UPGRADE_WARNING: 初始化窗体时可能激发事件 frmLogin.Resize。 单击以获得更多信息:'ms-help://MS.VSCC/commoner/redir/redirect.htm?keyword="vbup2075"'
Private Sub frmLogin_Resize(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles MyBase.Resize
On Error Resume Next
If Me.WindowState = 1 Then Exit Sub
Me.Width = VB6.TwipsToPixelsX(4410)
Me.Height = VB6.TwipsToPixelsY(2040)
End Sub
'UPGRADE_WARNING: Form 事件 frmLogin.Unload 具有新的行为。 单击以获得更多信息:'ms-help://MS.VSCC/commoner/redir/redirect.htm?keyword="vbup2065"'
Private Sub frmLogin_Closed(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles MyBase.Closed
SaveSetting(VB6.GetExeName(), "Login", "Left", CStr(VB6.PixelsToTwipsX(Me.Left)))
SaveSetting(VB6.GetExeName(), "Login", "Top", CStr(VB6.PixelsToTwipsY(Me.Top)))
End Sub
'UPGRADE_WARNING: 初始化窗体时可能激发事件 UserTxt.SelectedIndexChanged。 单击以获得更多信息:'ms-help://MS.VSCC/commoner/redir/redirect.htm?keyword="vbup2075"'
Private Sub UserTxt_SelectedIndexChanged(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles UserTxt.SelectedIndexChanged
System.Windows.Forms.SendKeys.Send("{Tab}")
End Sub
Private Sub UserTxt_Leave(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles UserTxt.Leave
txtPassword.Focus()
End Sub
End Class
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -