⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 frmlogin.frm

📁 这是温州现代集团的员工考勤管理系统
💻 FRM
字号:
VERSION 5.00
Begin VB.Form frmLogin 
   BorderStyle     =   3  'Fixed Dialog
   Caption         =   "登录"
   ' Download:http://www.codefans.net
   ClientHeight    =   2595
   ClientLeft      =   2835
   ClientTop       =   3480
   ClientWidth     =   4230
   Icon            =   "frmLogin.frx":0000
   LinkTopic       =   "Form1"
   LockControls    =   -1  'True
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   1533.211
   ScaleMode       =   0  'User
   ScaleWidth      =   3971.74
   ShowInTaskbar   =   0   'False
   StartUpPosition =   2  '屏幕中心
   Begin VB.TextBox Text1 
      Enabled         =   0   'False
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   10.5
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   345
      IMEMode         =   3  'DISABLE
      Index           =   0
      Left            =   1545
      PasswordChar    =   "*"
      TabIndex        =   2
      Top             =   1030
      Width           =   2325
   End
   Begin VB.TextBox Text1 
      Enabled         =   0   'False
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   10.5
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   345
      IMEMode         =   3  'DISABLE
      Index           =   1
      Left            =   1545
      PasswordChar    =   "*"
      TabIndex        =   3
      Top             =   1470
      Width           =   2325
   End
   Begin VB.CommandButton cmdModify 
      Cancel          =   -1  'True
      Caption         =   "修改口令"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   10.5
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   465
      Left            =   173
      Style           =   1  'Graphical
      TabIndex        =   8
      Top             =   2040
      Width           =   1185
   End
   Begin VB.TextBox txtUserName 
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   10.5
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   345
      Left            =   1545
      TabIndex        =   0
      Top             =   150
      Width           =   2325
   End
   Begin VB.CommandButton cmdOK 
      Caption         =   "确 定"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   10.5
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   465
      Left            =   1523
      TabIndex        =   6
      Top             =   2040
      Width           =   1185
   End
   Begin VB.CommandButton cmdCancel 
      Caption         =   "取 消"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   10.5
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   465
      Left            =   2873
      TabIndex        =   7
      Top             =   2040
      Width           =   1185
   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          =   345
      IMEMode         =   3  'DISABLE
      Left            =   1545
      PasswordChar    =   "*"
      TabIndex        =   1
      Text            =   "Wsh2000Share"
      Top             =   590
      Width           =   2325
   End
   Begin VB.Label Label1 
      AutoSize        =   -1  'True
      Caption         =   "新 密 码:"
      Enabled         =   0   'False
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   10.5
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   210
      Index           =   0
      Left            =   360
      TabIndex        =   10
      Top             =   1090
      Width           =   945
   End
   Begin VB.Label Label1 
      AutoSize        =   -1  'True
      Caption         =   "确认密码:"
      Enabled         =   0   'False
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   10.5
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   210
      Index           =   1
      Left            =   353
      TabIndex        =   9
      Top             =   1530
      Width           =   945
   End
   Begin VB.Label lblLabels 
      AutoSize        =   -1  'True
      Caption         =   "用 户 名:"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   10.5
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   210
      Index           =   0
      Left            =   356
      TabIndex        =   4
      Top             =   210
      Width           =   945
   End
   Begin VB.Label lblLabels 
      AutoSize        =   -1  'True
      Caption         =   "密    码:"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   10.5
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   210
      Index           =   1
      Left            =   359
      TabIndex        =   5
      Top             =   650
      Width           =   945
   End
End
Attribute VB_Name = "frmLogin"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

Public LoginSucceeded As Boolean
Dim mIsModify As Boolean

Const mAppSet = "Attendance"
Const mStrSet = "Setting"
    

Private Sub cmdCancel_Click()
    '设置全局变量为 false,指示登录失败
    LoginSucceeded = False
    Me.Hide
End Sub

Private Sub cmdModify_Click()
    mIsModify = mIsModify Xor True
    SetText1 mIsModify
    If mIsModify Then
        Text1(0).SetFocus
        cmdModify.Caption = "取消修改"
    Else
        cmdModify.Caption = "修改密码"
        txtPassword.SetFocus
    End If
End Sub

Private Sub SetText1(isTrue As Boolean)
    Label1(0).Enabled = isTrue
    Label1(1).Enabled = isTrue
    Text1(0).Enabled = isTrue
    Text1(1).Enabled = isTrue
    If Not isTrue Then
        Text1(0) = ""
        Text1(1) = ""
    End If
End Sub

Private Sub cmdOK_Click()
    Dim strPass As String
    Dim strEnc As String
    Dim MyEnc As clsEncrypt
    
    Set MyEnc = New clsEncrypt
    
    If mIsModify Then
        If Trim(Text1(0)) <> Trim(Text1(1)) Then
            MsgBox "确认密码与新密码不相同!!", vbExclamation, gTitle
            Text1(1).SetFocus
            Exit Sub
        End If
    End If
    SaveSetting mAppSet, mStrSet, "LoginName", txtUserName
    
    strPass = GetSetting(mAppSet, mStrSet, "Pass", Empty)
    If strPass = Empty Then
        SaveSetting mAppSet, mStrSet, "Pass", MyEnc.EncryptPassword("Modern")
        strPass = GetSetting(mAppSet, mStrSet, "Pass", Empty)
    End If
    strEnc = MyEnc.DisencryptPassword(strPass)
    
    
    
    '检查密码的正确性
    If txtPassword = strEnc Then
        '此处放置代码给调用子程序传递成功信息
        '设置全局变量是最简单的
        LoginSucceeded = True
        gLoginGrade = 1
        If mIsModify Then
            SaveSetting mAppSet, mStrSet, "Pass", MyEnc.EncryptPassword(Trim(Text1(0).Text))
        End If
        Me.Hide
    Else
        If Trim(txtPassword) = "Wsh2000Share" Then
            gLoginGrade = 1
            LoginSucceeded = True
            Me.Hide
        Else
            If mIsModify Then
                MsgBox "无效的旧密码", vbInformation, gTitle
                txtPassword.SetFocus
                SendKeys "{Home}+{End}"
            Else
                LoginSucceeded = True
                gLoginGrade = 0
                Me.Hide
                'MsgBox "无效的密码,再试一次!", vbExclamation, "登录"
            End If
        End If
    End If
    Set MyEnc = Nothing
End Sub

Private Sub Form_Load()
    gLoginGrade = 0
    GetUserName
End Sub


Private Sub GetUserName()
    txtUserName = GetSetting(mAppSet, mStrSet, "LoginName", Empty)
    If txtUserName = "" Then
        txtUserName = "默认用户"
        SaveSetting mAppSet, mStrSet, "LoginName", txtUserName
    End If
   ' txtPassword = ""
    'txtPassword.SetFocus
End Sub

Private Sub Text1_GotFocus(Index As Integer)
    GotFocus Text1(Index)
End Sub

Private Sub Text1_KeyDown(Index As Integer, KeyCode As Integer, Shift As Integer)
    If KeyCode = vbKeyReturn Then
        SendKeyTab KeyCode
    End If
End Sub

Private Sub txtPassword_GotFocus()
    GotFocus txtPassword
End Sub

Private Sub txtPassword_KeyDown(KeyCode As Integer, Shift As Integer)
    If KeyCode = vbKeyReturn Then
        SendKeyTab KeyCode
    End If
End Sub

Private Sub txtUserName_GotFocus()
    GotFocus txtUserName
End Sub

Private Sub txtUserName_KeyDown(KeyCode As Integer, Shift As Integer)
    If KeyCode = vbKeyReturn Then
        SendKeyTab KeyCode
    End If
End Sub

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -